{"record":{"id":"1292c41c81cb222b","repo":"Budibase/budibase","slug":"config-id-not-found","errorCode":null,"errorMessage":"Config id 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":20,"sourceCode":"import { quotas } from \"@budibase/pro\"\nimport { BUDIBASE_AI_PROVIDER_ID, LLMResponse } from \"@budibase/types\"\nimport tracer from \"dd-trace\"\nimport sdk from \"../../..\"\nimport { 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    )","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/llm/index.ts#L2-L38","documentation":"Thrown by createLLM when the configId argument is falsy (empty string, undefined, null). An AI config id is mandatory to resolve which LLM provider/model to use, so calls without one are rejected immediately with HTTPError 422 before any lookup.","triggerScenarios":"Calling createLLM (directly or via chat/agent helpers) with a configId parameter that is empty or undefined — e.g. an AI config variable that was never set, a deleted config referenced by id, or a caller passing an unset options field.","commonSituations":"Automations or apps referencing an AI configuration that was deleted; environment/app variables for AI config ids left blank; API integrations omitting the configId field in the request body.","solutions":["Verify the AI config exists in the workspace and copy its id into the call","Fix the caller (automation step, API request) to pass a non-empty configId","If the config was deleted, recreate it and update references","Add validation at the entry point of your integration to reject empty config ids early"],"exampleFix":"// before\nawait llm({ configId: options.configId })\n// after\nif (!options.configId) {\n  throw new HTTPError(\"configId is required\", 422)\n}\nawait llm({ configId: options.configId })","handlingStrategy":"validation","validationCode":"function requireConfigId(id: string | undefined): string {\n  if (!id) throw new HTTPError(\"AI configId is required\", 422)\n  return id\n}\nawait createLLM(requireConfigId(options.configId), sessionId)","typeGuard":null,"tryCatchPattern":"try {\n  await createLLM(configId, sessionId)\n} catch (e) {\n  if (e instanceof HTTPError && e.message === \"Config id not found\") {\n    return { error: \"No AI configuration was provided — select an AI config\" }\n  }\n  throw e\n}","preventionTips":["Validate that AI config variables are filled before saving automations","Use config lookups by name at call time instead of hardcoding ids","Add required-field checks in API request schemas for configId"],"tags":["validation","ai-config","bad-request","budibase-ai"],"backgroundTag":"missing-required-parameter","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}