sbklS
Convex Community5mo ago
1 reply
sbkl

File <fileId> not found when incrementing refcount

I have a document to markdown agent that store a file for later converting it to markdown:

I store and register the file with the documentToMarkdownAgent like so:

    const { file } = await storeFile(
      ctx,
      components.documentToMarkdownAgent,
      new Blob([args.bytes], { type: args.mimeType }),
      { filename: args.filename, sha256: args.sha256 }
    );


Later, I want to reference the fileId with the summary agent when using it to summarise the document

      const { messageId: summaryMessageId } = await summaryAgent.saveMessage(
        ctx,
        {
          threadId: summaryThreadId,
          userId,
          message: {
            role: "user",
            content: [
              {
                type: "text",
                text: `Summarise the content of the context provided in a concise manner:
              <context>
              ${markdownText}
              </context>`,
              },
            ],
          },
          metadata: { fileIds: [fileId] },
        }
      );


This step triggers the error: File <fileId> not found when incrementing refcount.
When checking the files table under the documentToMarkdownAgent in the dashboard, I can see the file and the right id that is claimed not to be found. I can also see the refCount being updated when referencing it with the documentToMarkdownAgent.

Am I doing anything wrong here?
Was this page helpful?