Budibase/budibase · error · HTTPError
LLM not available
Error message
LLM not available
What it means
TableGeneration.init validates that an LLM configuration (aiModel) was resolved before constructing the generator. A missing/empty aiModel means there is no LLM available to perform AI table generation, so an HTTPError 422 is thrown early rather than failing mid-request.
Source
Thrown at packages/pro/src/ai/generators/tableGeneration.ts:44
tables: Record<string, TableSchemaFromAI>
) => Promise<void>
}
type ProgressCallback = (message: string) => void
export class TableGeneration {
private aiModel: LLMResponse
private delegates: Delegates
private constructor(aiModel: LLMResponse, delegates: Delegates) {
this.aiModel = aiModel
this.delegates = delegates
}
static async init(aiModel: LLMResponse, delegates: Delegates) {
if (!aiModel) {
throw new HTTPError("LLM not available", 422)
}
return new TableGeneration(aiModel, delegates)
}
async generate(
userPrompt: string,
userId: string,
onProgress?: ProgressCallback
) {
return tracer.trace("tableGeneration.generate", async span => {
const tables = await this.generateTables(userPrompt, userId, onProgress)
span.addTags({ table_count: tables.length })
return tables
})
}
private llmFunctions = {
getTableStructure: async (View on GitHub (pinned to a81a902e9a)
Solutions
- Configure an LLM for the instance (AI settings / provider API keys) and select a model.
- Ensure the AI proxy (e.g. LiteLLM at localhost:4000 in dev) is running and reachable.
- Verify the license includes the AI feature if it is license-gated.
- Guard the UI so the AI table generation option is hidden when no model is available, instead of calling the endpoint.
Example fix
// before
const tables = await generateTables({ prompt })
// after
const model = await getAvailableLLM()
if (!model) {
toast.error("No AI model configured for this instance")
return
}
const tables = await generateTables({ prompt }) Defensive patterns
Strategy: validation
Validate before calling
const model = await getAvailableLLM()
if (!model) throw new Error("Configure an AI model before using AI table generation") Type guard
function hasAIModel(model: LLMResponse | null | undefined): model is LLMResponse {
return model != null && typeof model === "object"
} Try / catch
try {
return await generateTables(req)
} catch (e) {
if (e.status === 422 && e.message === "LLM not available") {
promptUserToConfigureAI()
} else throw e
} Prevention
- Configure LLM provider and API keys at install time
- Keep the AI proxy (LiteLLM) running in local dev
- Hide AI features in the UI when no model is available
- Confirm license entitlements for AI features
When it happens
Trigger: Calling the AI table generation endpoint (POST /api/ai/tables) on an instance where no LLM is configured, the AI provider config failed to load, or the resolved aiModel is null/undefined (no model selected or AI feature not enabled/licensed).
Common situations: Self-hosted Budibase without AI/LLM environment configuration, missing provider API keys, license without AI feature, LiteLLM/AI proxy not running or unreachable so the model lookup returns nothing.
Related errors
- Error generating tables
- AI message content must be a string
- No response found
- AI user message must be a string
- AI system message must be a string
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/56d38198ddf774ab.
Report an issue: GitHub.