Budibase/budibase · error · Error
File id not found
Error message
File id not found
What it means
Thrown in uploadFile when the LiteLLM /v1/files response JSON lacks a string `id`. The raw error is logged with console.error before being rethrown. This mirrors error 543 but for the direct LiteLLM client path rather than the BBAI client path.
Source
Thrown at packages/server/src/sdk/workspace/ai/llm/litellm.ts:240
formdata.append("file", fileBlob, filename)
formdata.append("model", model)
const requestOptions = {
method: "POST",
headers: {
Authorization: liteLLMAuthorizationHeader,
},
body: formdata,
}
try {
const res = await fetch(
`${environment.LITELLM_URL}/v1/files`,
requestOptions
)
const json = await res.json()
if (typeof json.id !== "string") {
throw new Error("File id not found")
}
return unwrapLiteLLMFileId(json.id)
} catch (e) {
console.error("Error uploading file to LiteLLM", e)
throw e
}
}
export function unwrapLiteLLMFileId(fileId: string): string {
if (!fileId.startsWith("file-")) {
return fileId
}
const encodedPart = fileId.slice("file-".length)
try {
const decoded = Buffer.from(encodedPart, "base64").toString("utf8")
const match = decoded.match(/^litellm:(file-[^;]+);/)
if (match?.[1]) {View on GitHub (pinned to a81a902e9a)
Solutions
- Inspect the logged "Error uploading file to LiteLLM" output for the actual response payload
- Upgrade the LiteLLM proxy to a version supporting OpenAI-compatible /v1/files for your target provider
- Verify the file meets the provider's size/type limits and retry with a smaller file
- Check the provider configured in LiteLLM for the model actually supports file inputs
Example fix
// before: silent shape failure
const json = await res.json()
if (typeof json.id !== "string") {
throw new Error("File id not found")
}
// after: include payload for diagnosis
if (typeof json.id !== "string") {
throw new Error(`LiteLLM file upload returned no id: ${JSON.stringify(json).slice(0, 500)}`)
} Defensive patterns
Strategy: type-guard
Validate before calling
const res = await fetch(`${env.LITELLM_URL}/v1/files`, requestOptions)
const json = await res.json()
if (typeof json?.id !== "string") {
throw new Error(`LiteLLM upload failed: ${JSON.stringify(json).slice(0, 300)}`)
} Type guard
function isFileUploadResponse(x: unknown): x is { id: string } {
return typeof x === "object" && x !== null && typeof (x as { id?: unknown }).id === "string"
} Try / catch
try {
const id = await uploadFile(blob, purpose)
} catch (e) {
if (e.message === "File id not found") {
// logged upstream; fall back or surface provider limit error
return { error: "File could not be uploaded to LiteLLM" }
}
throw e
} Prevention
- Keep the LiteLLM proxy upgraded to a version supporting /v1/files for your providers
- Enforce provider file size/type limits before upload
- Add an upload smoke test to CI against your LiteLLM deployment
When it happens
Trigger: Uploading a file to LiteLLM (fileId flow) when LiteLLM returns a JSON body without `id` — provider upstream errors wrapped in a 200 response, LiteLLM version without compatible files API, or a proxy/gateway intercepting the upload.
Common situations: LiteLLM proxy misrouting /v1/files to an unsupported provider; older LiteLLM deployments; oversized files rejected upstream with an error JSON instead of an HTTP error status.
Related errors
- File id not found
- Budibase AI is not configured in this environment (BBAI_LITE
- LiteLLM should be configured. Contact support if the issue p
- Slack app creation response was incomplete
- Provider ${config.provider} not found
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/19cfcc97804b3dc1.
Report an issue: GitHub.