{"record":{"id":"435ccbb8b6ff5045","repo":"Budibase/budibase","slug":"gemini-file-store-creation-did-not-return-an-id","errorCode":null,"errorMessage":"Gemini file store creation did not return an id","messagePattern":"Gemini file store creation did not return an id","errorType":"http","errorClass":"HTTPError","httpStatus":500,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/knowledgeBase/geminiFileStore.ts","lineNumber":163,"sourceCode":"  const geminiApiKey = getGeminiApiKey()\n  const response = await fetch(`${environment.LITELLM_URL}/v1/vector_stores`, {\n    method: \"POST\",\n    headers: await getCommonAuthHeaders(),\n    body: JSON.stringify({\n      name,\n      custom_llm_provider: \"gemini\",\n      ...(geminiApiKey ? { api_key: geminiApiKey } : {}),\n    }),\n  })\n\n  await handleNotOkResponse({\n    response,\n    fallbackMessage: \"Failed to create Gemini file store\",\n  })\n\n  const payload = (await response.json()) as CreateVectorStoreResponse\n  if (!payload.id) {\n    throw new HTTPError(\"Gemini file store creation did not return an id\", 500)\n  }\n\n  return payload.id\n}\n\nexport async function deleteGeminiVectorStore(\n  vectorStoreId: string\n): Promise<void> {\n  const geminiApiKey = getGeminiApiKey()\n  const response = await requestWithRetries(async () =>\n    fetch(\n      `${environment.LITELLM_URL}/v1/vector_stores/${encodeURIComponent(vectorStoreId)}`,\n      {\n        method: \"DELETE\",\n        headers: await getCommonAuthHeaders(),\n        body: JSON.stringify({\n          custom_llm_provider: \"gemini\",\n          ...(geminiApiKey ? { api_key: geminiApiKey } : {}),","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/knowledgeBase/geminiFileStore.ts#L145-L181","documentation":"createGeminiFileStore POSTs to LiteLLM to create a Gemini vector store. After a successful (ok) response, it parses the JSON and expects an `id` field; if the payload has no id, HTTPError 500 is thrown because the store cannot be referenced later. This indicates an unexpected response shape from the proxy.","triggerScenarios":"The vector_stores endpoint returns 200 with a body lacking `id` — e.g. LiteLLM version that returns a different envelope (id nested elsewhere or named differently), or a proxy/gateway returning a 2xx with an empty or HTML body.","commonSituations":"Outdated or non-standard LiteLLM proxy behind LITELLM_URL that doesn't implement the OpenAI-compatible vector_stores API; a reverse proxy (nginx) returning 200 with an error page; LiteLLM version drift after upgrade.","solutions":["Verify LITELLM_URL points at a LiteLLM version supporting POST /v1/vector_stores with {id} in the response","Log the raw response body to inspect the actual payload shape","Upgrade LiteLLM or align the proxy to the expected OpenAI vector-stores response format","Retry the creation — a transient proxy fault can return an empty 2xx"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const hasStoreId = (p: unknown): p is { id: string } =>\n  typeof p === \"object\" && p !== null && \"id\" in p && typeof (p as { id: unknown }).id === \"string\"\n","tryCatchPattern":"try {\n  const storeId = await createGeminiFileStore(name)\n} catch (e) {\n  if (e instanceof HTTPError && e.status === 500 && e.message.includes(\"did not return an id\")) {\n    // inspect LiteLLM version/response shape, retry or upgrade proxy\n  }\n}","preventionTips":["Pin/verify a LiteLLM version that returns { id } from POST /v1/vector_stores","Log raw responses from the vector_stores endpoint during integration tests","Beware reverse proxies that swallow bodies and return 2xx"],"tags":["api-contract","litellm","gemini","server"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}