{"record":{"id":"c660846c8cf43126","repo":"Budibase/budibase","slug":"knowledge-base-type-cannot-be-changed","errorCode":null,"errorMessage":"Knowledge base type cannot be changed","messagePattern":"Knowledge base type cannot be changed","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/knowledgeBase/crud.ts","lineNumber":125,"sourceCode":"export async function update(\n  config: UpdateKnowledgeBaseRequest\n): Promise<KnowledgeBase> {\n  if (!config._id || !config._rev) {\n    throw new HTTPError(\"id and rev required\", 400)\n  }\n\n  const db = context.getWorkspaceDB()\n  const existing = await db.tryGet<KnowledgeBase>(config._id)\n  if (!existing) {\n    throw new HTTPError(\"Knowledge base not found\", 404)\n  }\n\n  let updated: KnowledgeBase\n  const knowledgeBaseType = config.type\n  switch (knowledgeBaseType) {\n    case KnowledgeBaseType.GEMINI: {\n      if (knowledgeBaseType !== existing.type) {\n        throw new HTTPError(\"Knowledge base type cannot be changed\", 400)\n      }\n      updated = {\n        ...existing,\n        ...config,\n        type: KnowledgeBaseType.GEMINI,\n        config: { googleFileStoreId: existing.config.googleFileStoreId },\n      } satisfies GeminiKnowledgeBase\n      break\n    }\n    default:\n      throw utils.unreachable(knowledgeBaseType)\n  }\n\n  if (\n    updated.type === KnowledgeBaseType.GEMINI &&\n    !updated.config.googleFileStoreId\n  ) {\n    throw new HTTPError(","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/knowledgeBase/crud.ts#L107-L143","documentation":"Error \"Knowledge base type cannot be changed\" thrown in Budibase/budibase.","triggerScenarios":"Thrown at packages/server/src/sdk/workspace/ai/knowledgeBase/crud.ts:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}