Budibase/budibase · error · Error
File id not found
Error message
File id not found
What it means
Thrown during LiteLLM file upload when the /v1/files response JSON parses successfully but has no string `id` field. Budibase needs the LiteLLM file id to reference the uploaded file in subsequent chat calls, so an unexpected response shape is rejected with this error.
Source
Thrown at packages/server/src/sdk/workspace/ai/llm/bbai.ts:258
formdata.append("file", fileBlob, filename)
formdata.append("model", model)
const liteLLMBaseUrl = environment.LITELLM_URL.replace(/\/v1\/?$/, "")
const response = await fetch(`${liteLLMBaseUrl}/v1/files`, {
method: "POST",
headers: {
Authorization: `Bearer ${getBBAIKey()}`,
},
body: formdata,
})
if (!response.ok) {
throw await HTTPError.fromResponse(response)
}
const result = await response.json()
if (typeof result.id !== "string") {
throw new Error("File id not found")
}
return unwrapLiteLLMFileId(result.id)
} else {
const fileBuffer = Buffer.from(await fileBlob.arrayBuffer())
const base64 = fileBuffer.toString("base64")
if (isImage) {
return `data:${type};base64,${base64}`
}
if (!env.BUDICLOUD_URL) {
throw new Error("No Budibase URL found")
}
const licenseKey = await licensing.keys.getLicenseKey()
if (!licenseKey) {
throw new Error("No license key found")
}
const response = await fetch(View on GitHub (pinned to a81a902e9a)
Solutions
- Log/inspect the full LiteLLM /v1/files response body to see the actual payload
- Upgrade LiteLLM to a version with OpenAI-compatible file upload support
- Verify LITELLM_URL points at the LiteLLM proxy root, not a provider directly
- Check LiteLLM proxy logs for upstream provider errors swallowed during upload
Example fix
// before: blind cast
const result = await response.json()
return result.id
// after: guard the shape
const result = await response.json()
if (typeof result.id !== "string") {
throw new Error(`Unexpected LiteLLM file upload response: ${JSON.stringify(result)}`)
} Defensive patterns
Strategy: type-guard
Validate before calling
const res = await fetch(`${litellmUrl}/v1/files`, init)
const body = await res.json()
if (typeof body?.id !== "string") {
throw new Error(`LiteLLM upload returned unexpected payload`)
} Type guard
function hasFileId(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 bbaiClient.uploadFile(blob, type)
} catch (e) {
if (e.message === "File id not found") {
log.error("LiteLLM file upload returned malformed response — check LiteLLM version/proxy")
}
throw e
} Prevention
- Pin a LiteLLM version known to support OpenAI-compatible /v1/files
- Point LITELLM_URL at the LiteLLM proxy, not a raw provider
- Add an integration smoke test that uploads a tiny file on deploy
When it happens
Trigger: Uploading a file via createBBAIClient's LiteLLM path when LiteLLM returns an error payload (e.g. a JSON error body with HTTP 200, or a proxy returning HTML/JSON without id), or a LiteLLM version whose files API response schema differs.
Common situations: LiteLLM behind a misconfigured proxy that intercepts file uploads; LiteLLM deployed at an older version without OpenAI-compatible /v1/files support; provider upstream rejecting the file but LiteLLM not propagating the failure 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/a6889cbc4815474c.
Report an issue: GitHub.