{"record":{"id":"18016eec97e3a1eb","repo":"Budibase/budibase","slug":"config-id-configid-not-found","errorCode":null,"errorMessage":"Config id \"${configId}\" not found","messagePattern":"Config id \"(.+?)\" not found","errorType":"http","errorClass":"HTTPError","httpStatus":422,"severity":"warning","filePath":"packages/server/src/sdk/workspace/ai/llm/index.ts","lineNumber":24,"sourceCode":"import { createBBAIClient } from \"./bbai\"\nimport { createLiteLLMOpenAI } from \"./litellm\"\n\nexport * as bbai from \"./bbai\"\nexport * from \"./utils\"\nexport * from \"./messages\"\n\nexport async function createLLM(\n  configId: string,\n  sessionId?: string,\n  span?: tracer.Span,\n  agentId?: string\n): Promise<LLMResponse> {\n  if (!configId) {\n    throw new HTTPError(\"Config id not found\", 422)\n  }\n  const aiConfig = await sdk.ai.configs.find(configId)\n  if (!aiConfig) {\n    throw new HTTPError(`Config id \"${configId}\" not found`, 422)\n  }\n\n  if (aiConfig.provider === BUDIBASE_AI_PROVIDER_ID) {\n    await quotas.throwIfBudibaseAICreditsExceeded()\n  }\n\n  if (aiConfig.provider === BUDIBASE_AI_PROVIDER_ID && !env.SELF_HOSTED) {\n    return createBBAIClient(\n      aiConfig.model,\n      sessionId,\n      span,\n      aiConfig.reasoningEffort,\n      agentId\n    )\n  }\n\n  return createLiteLLMOpenAI(aiConfig, sessionId, span, agentId)\n}","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/llm/index.ts#L6-L42","documentation":"Thrown by createLLM when a configId is provided but sdk.ai.configs.find(configId) returns nothing — the id is well-formed but no AI config with that id exists in the workspace. HTTPError 422 includes the offending id in the message.","triggerScenarios":"Chat/agent/reviewer flows referencing an AI config id that was deleted, belongs to a different workspace/app, or was copied from another environment (prod id used in dev, or vice versa).","commonSituations":"Exporting/importing apps between environments where AI config ids are not preserved; automation JSON copied across apps; config deleted while automations still reference it; database restore from a different workspace.","solutions":["Confirm the config id in the error message exists in THIS workspace's AI configurations","Recreate the AI config and update all references (automations, app definitions) with the new id","If migrating environments, re-link AI configs after import rather than copying ids","Check you are operating on the intended app/tenant — ids are workspace-scoped"],"exampleFix":"// before: id copied across environments\nconst configId = \"prod-config-id\"\n// after: resolve per environment\nconst config = (await sdk.ai.configs.fetch()).find(c => c.name === \"my-agent\")\nawait createLLM(config!._id!, sessionId)","handlingStrategy":"validation","validationCode":"const config = await sdk.ai.configs.find(configId)\nif (!config) {\n  throw new HTTPError(`AI config \"${configId}\" does not exist in this workspace`, 422)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createLLM(configId, sessionId)\n} catch (e) {\n  if (e instanceof HTTPError && /^Config id \".*\" not found$/.test(e.message)) {\n    const configs = await sdk.ai.configs.fetch()\n    return { error: `Unknown AI config; available: ${configs.map(c => c.name).join(\", \")}` }\n  }\n  throw e\n}","preventionTips":["Re-link AI configs after importing/exporting apps between environments","Cascade-delete or update automations when an AI config is deleted","Never copy resource ids across workspaces; resolve by name"],"tags":["ai-config","not-found","reference-error","budibase-ai"],"backgroundTag":"resource-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}