Budibase/budibase · error

Error generating tables

Error message

Error generating tables

What it means

While parsing the SSE stream from /api/ai/tables, an event with type "error" arrives from the server-side AI generation. The client surfaces the server-provided event.message, falling back to the generic "Error generating tables" when the message is empty. This is the transport for backend failures (e.g. LLM errors) during streaming.

Source

Thrown at packages/frontend-core/src/api/ai.ts:121

            if (done) {
              break
            }
            buffer += decoder.decode(value, { stream: true })

            let boundary = buffer.indexOf(SSE_EVENT_DELIMITER)
            while (boundary !== -1) {
              const eventChunk = buffer.slice(0, boundary)
              buffer = buffer.slice(boundary + SSE_EVENT_DELIMITER.length)

              const event = parseSSEEventChunk(eventChunk)
              if (event?.type === "progress" && onProgress) {
                onProgress(event.message)
              }
              if (event?.type === "result") {
                finalResponse = { createdTables: event.createdTables || [] }
              }
              if (event?.type === "error") {
                throw new Error(event.message || "Error generating tables")
              }

              boundary = buffer.indexOf(SSE_EVENT_DELIMITER)
            }
          }

          if (!finalResponse) {
            throw new Error("No result received from table generation stream")
          }

          return finalResponse
        } catch (error: any) {
          throw new Error(error?.message || "Error generating tables")
        }
      },
    })
  },

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Read the actual error message (event.message) in the thrown Error to identify the server-side cause.
  2. Check the backend/pro logs for the underlying LLM failure and verify the AI model is configured and licensed.
  3. Retry the request if the failure was transient (provider 429/5xx).
  4. Adjust the prompt or table requirements if the message indicates a content/policy rejection.

Example fix

// before
catch (e) { console.log(e) }
// after
catch (e) {
  toast.error(`Table generation failed: ${e.message}`)
  // inspect server logs for the LLM provider error
}
Defensive patterns

Strategy: retry

Validate before calling

// ensure backend reachable and model configured before calling
const health = await fetch("/api/ai/health").then(r => r.ok)

Type guard

function isAIStreamErrorEvent(ev: unknown): ev is { type: "error"; message: string } {
  return typeof ev === "object" && ev !== null && (ev as any).type === "error"
}

Try / catch

try {
  return await generateTables(req)
} catch (e) {
  if (isTransient(e.message)) return generateTables(req) // retry once
  showError(e.message)
}

Prevention

When it happens

Trigger: Server-side table generation fails after the stream has opened and it emits {type:"error"} — e.g. LLM provider error, invalid prompt, backend exception — and the client rethrows it in the parseResponse handler.

Common situations: LLM provider outage or rate limiting, invalid model config on the Budibase instance, prompt content rejected by the provider, license/quota exhaustion on the AI backend.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/0f8690b5cdd1bf77. Report an issue: GitHub.