Budibase/budibase · error · HTTPError
Agent is not properly configured: AI config "${agent.aiconfi
Error message
Agent is not properly configured: AI config "${agent.aiconfig}" not found What it means
After confirming agent.aiconfig is set, assertAgentHasValidConfig looks the config up via sdk.ai.configs.find. If the referenced config no longer exists, it throws a 422 HTTPError naming the missing config ID. This catches dangling references left behind when AI configs are deleted or belong to another workspace.
Source
Thrown at packages/server/src/sdk/workspace/ai/agents/utils.ts:473
export function formatIncompleteToolCallError(
incompleteTools: IncompleteToolCall[]
): string {
const toolNames = incompleteTools.map(t => t.toolName).join(", ")
return `The AI model failed to complete tool execution${toolNames ? ` for: ${toolNames}` : ""}. This may be due to a compatibility issue with the selected model. Please try a different model or try again.`
}
export const assertAgentHasValidConfig = async (agent: Agent) => {
if (!agent.aiconfig) {
throw new HTTPError(
"Agent is not properly configured: missing AI config",
422
)
}
const aiConfig = await sdk.ai.configs.find(agent.aiconfig)
if (!aiConfig) {
throw new HTTPError(
`Agent is not properly configured: AI config "${agent.aiconfig}" not found`,
422
)
}
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Re-point the agent's aiconfig to an existing AI config ID (create or select one) and save.
- Audit agents for dangling aiconfig references after deleting configs and clean them up.
- Catch the 422 HTTPError and surface 'AI config not found - reconfigure this agent' in the UI.
Example fix
// before await runAgent(agent) // 422: config "abc123" not found // after const configs = await sdk.ai.configs.fetch() agent.aiconfig = configs[0]._id await sdk.agents.update(agent) await runAgent(agent)
Defensive patterns
Strategy: validation
Validate before calling
const aiConfig = await sdk.ai.configs.find(agent.aiconfig)
if (!aiConfig) {
throw new HTTPError("Referenced AI config no longer exists - reconfigure the agent", 422)
}
await assertAgentHasValidConfig(agent) Type guard
const hasResolvableAiConfig = async (agent: Agent): Promise<boolean> => !!agent.aiconfig && !!(await sdk.ai.configs.find(agent.aiconfig))
Try / catch
try {
await assertAgentHasValidConfig(agent)
} catch (err) {
if (err instanceof HTTPError && err.status === 422 && err.message.includes("not found")) {
// re-point agent.aiconfig to an existing config and save
}
} Prevention
- When deleting an AI config, cascade-clear or reassign referencing agents.
- Periodically audit agents for dangling aiconfig references.
- Re-map config IDs when copying agents across environments.
When it happens
Trigger: Running an agent whose aiconfig points to a config ID that does not resolve - config deleted after the agent was created, config in a different app/workspace, or ID typo/corruption in the agent document.
Common situations: Deleting an AI config that is still referenced by agents; copying agents between environments where config IDs differ; license/tenant changes removing cloud-provided configs.
Related errors
- Agent is not properly configured: missing AI config
- Workspace DB not found - self-host users using cloud don't h
- CouchDB username not set
- CouchDB password not set
- No google configuration found
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/1b9c94b1b42f245e.
Report an issue: GitHub.