Budibase/budibase · warning
We didn't understand your prompt. This can happen if the pro
Error message
We didn't understand your prompt. This can happen if the prompt isn't specific, or if it's a request for something other than code. Try expressing your request in a different way.
What it means
AIGen.svelte sends the user's prompt to the AI code-generation API (API.generateJs). If the service responds successfully but returns an empty code string — meaning the model couldn't produce code from the prompt — the component throws this descriptive error telling the user to rephrase. The catch block then surfaces it as a notification.
Source
Thrown at packages/builder/src/components/common/CodeEditor/AIGen.svelte:45
const thresholdExpansionWidth = 350
$: shouldAlwaysBeExpanded =
expandedOnly ||
(parentWidth !== null && parentWidth > thresholdExpansionWidth)
$: expanded = shouldAlwaysBeExpanded || expanded
async function generateJs(prompt: string) {
promptText = ""
if (!prompt.trim()) return
previousContents = value
promptText = prompt
try {
const resp = await API.generateJs({ prompt, bindings })
const code = resp.code
if (code === "") {
throw new Error(
"We didn't understand your prompt. This can happen if the prompt isn't specific, or if it's a request for something other than code. Try expressing your request in a different way."
)
}
suggestedCode = code
dispatch("update", { code })
} catch (e: any) {
console.error(e)
if ("code" in e && e.code === APIWarningCode.USAGE_LIMIT_EXCEEDED) {
notifications.error(
"Monthly usage limit reached. We're exploring options to expand this soon. Questions? Contact support@budibase.com"
)
} else if ("message" in e) {
notifications.error(`Unable to generate code: ${e.message}`)
} else {
notifications.error(`Unable to generate code.`)
}
}View on GitHub (pinned to a81a902e9a)
Solutions
- Rewrite the prompt to explicitly describe the code you want, including inputs and expected output
- Add context — mention the variable/bindings to use and the framework (plain JS in a Budibase binding)
- Break the request into a smaller, single-purpose code generation task
- Retry once in case the empty response was transient; if persistent, the prompt content is the issue
Example fix
// before (prompt) "make it work" // after (prompt) "Write a JavaScript function that takes the binding data.items and returns them sorted by the 'name' property alphabetically"
Defensive patterns
Strategy: validation
Validate before calling
if (!prompt || prompt.trim().length < 10) {
throw new Error("Prompt too vague for AI code generation")
} Type guard
null
Try / catch
try {
const resp = await API.generateJs({ prompt, bindings })
if (!resp.code) throw new Error("AI returned no code — rephrase the prompt")
} catch (e) {
notify.error(e.message)
} Prevention
- Write specific prompts describing inputs, outputs and behavior
- Include the relevant bindings/variables in the prompt
- Request one focused piece of code per prompt
- Retry once on empty responses before changing the prompt
When it happens
Trigger: Submitting an AI prompt in the builder code editor where the backend returns code === "": vague prompts, prompts not related to code generation, prompts the safety/model layer refuses, or bindings/prompt combinations the model can't satisfy.
Common situations: Asking conversational questions ("what does this do?") instead of requesting code; overly short or ambiguous prompts like "sort it"; prompts in non-English phrasing the model misreads; transient model degradation returning empty output.
Related errors
- AI message content must be a string
- Source table '${relationship.sourceTable}' not found in data
- Target table '${relationship.targetTable}' not found in data
- Invalid custom REST template
- automationId and appId are required
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/c4fb5b83ae07df1b.
Report an issue: GitHub.