Budibase/budibase · error · HTTPError

Knowledge base file does not have an object key

Error message

Knowledge base file does not have an object key

What it means

retryKnowledgeBaseFileIngestion re-enqueues ingestion for a failed knowledge base file. To reprocess the file it needs the object store key (the path of the uploaded file in the APPS bucket). If the file record has no objectStoreKey there is nothing to re-ingest, so a 400 HTTPError is thrown.

Source

Thrown at packages/server/src/sdk/workspace/ai/knowledgeBase/uploads.ts:225

        error?.message || "Failed to enqueue file for processing"
      await updateKnowledgeBaseFile(file)
      console.error("Failed to enqueue knowledge base file during reset", {
        workspaceId,
        knowledgeBaseId,
        fileId: file._id,
        error,
      })
    }
  }
}

export const retryKnowledgeBaseFileIngestion = async (fileId: string) => {
  const workspaceId = context.getOrThrowWorkspaceId()
  const file = await getKnowledgeBaseFileOrThrow(fileId)
  const startedAtMs = Date.now()

  if (!file.objectStoreKey) {
    throw new HTTPError("Knowledge base file does not have an object key", 400)
  }
  if (file.status !== KnowledgeBaseFileStatus.FAILED) {
    throw new HTTPError("Knowledge base file is not in failed state", 400)
  }

  file.status = KnowledgeBaseFileStatus.PROCESSING
  file.errorMessage = undefined
  file.processedAt = undefined
  await updateKnowledgeBaseFile(file)
  console.log("Retrying knowledge base file ingestion", {
    workspaceId,
    knowledgeBaseId: file.knowledgeBaseId,
    fileId,
    objectStoreKey: file.objectStoreKey,
  })

  try {
    await enqueueRagFileIngestion({

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Re-upload the file via the normal knowledge base upload endpoint so a fresh record with objectStoreKey is created, instead of retrying.
  2. Check the file document in the workspace DB — if objectStoreKey is genuinely absent the file cannot be retried.
  3. Only call retry for files that completed upload (uploadKnowledgeBaseFile succeeded) but failed during ingestion.

Example fix

// before
await retryKnowledgeBaseFileIngestion(fileId) // file has no objectStoreKey
// after
const file = await getKnowledgeBaseFileOrThrow(fileId)
if (file.objectStoreKey) {
  await retryKnowledgeBaseFileIngestion(fileId)
} else {
  await uploadKnowledgeBaseFile({ knowledgeBaseId: file.knowledgeBaseId, ... })
}
Defensive patterns

Strategy: validation

Validate before calling

const file = await getKnowledgeBaseFileOrThrow(fileId)
if (!file.objectStoreKey) {
  // cannot retry: re-upload instead
  return reuploadKnowledgeBaseFile(file)
}
await retryKnowledgeBaseFileIngestion(fileId)

Type guard

const isRetryableKnowledgeBaseFile = (
  f: KnowledgeBaseFile
): f is KnowledgeBaseFile & { objectStoreKey: string } =>
  typeof f.objectStoreKey === "string" && f.objectStoreKey.length > 0

Try / catch

try {
  await retryKnowledgeBaseFileIngestion(fileId)
} catch (err) {
  if (err instanceof HTTPError && err.status === 400) {
    // fall back to re-uploading the file
  }
  throw err
}

Prevention

When it happens

Trigger: Calling retryKnowledgeBaseFileIngestion(fileId) where the stored KnowledgeBaseFile document lacks objectStoreKey — e.g. the record was created before the upload step completed, or the upload failed and the key was never assigned.

Common situations: Retrying ingestion for a file whose original upload errored out (the upload path deletes the object but may leave a record without a usable key), or manually created/corrupted file records in the workspace DB.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/49b88c28450c3500. Report an issue: GitHub.