Budibase/budibase · error · AICreditsExhaustedError

USAGE_LIMIT_EXCEEDED

USAGE_LIMIT_EXCEEDED

Error message

You have reached your Budibase AI Credits limit for this billing cycle.

What it means

Before spending a Budibase AI credit, throwIfBudibaseAICreditsExceeded asks the quota system whether monthly BUDIBASE_AI_CREDITS usage would exceed the licensed limit. When exceeded, it throws AICreditsExhaustedError (an HTTPError carrying code USAGE_LIMIT_EXCEEDED) with this message. It is a hard monthly billing-cycle limit on AI usage, not a transient failure.

Source

Thrown at packages/pro/src/sdk/quotas/helpers/ai.ts:49

  const licensedQuota = await quotas.getLicensedQuota(
    QuotaType.USAGE,
    MonthlyQuotaName.BUDIBASE_AI_CREDITS,
    QuotaUsageType.MONTHLY
  )
  // value === -1 means UNLIMITED, nothing to cap
  if (licensedQuota.value >= 0) {
    await setBudibaseAICredits(licensedQuota.value)
  }
}

export const throwIfBudibaseAICreditsExceeded = async () => {
  const exceeded = await quotas.usageLimitIsExceeded({
    name: MonthlyQuotaName.BUDIBASE_AI_CREDITS,
    type: QuotaUsageType.MONTHLY,
    usageChange: 1,
  })
  if (exceeded) {
    throw new AICreditsExhaustedError()
  }
}

export const setBudibaseAICredits = async (count: number) => {
  return quotas.set(
    MonthlyQuotaName.BUDIBASE_AI_CREDITS,
    QuotaUsageType.MONTHLY,
    count
  )
}

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Wait for the monthly billing cycle to reset the AI credits usage, or upgrade the plan/license for more AI credits
  2. Check current usage via the quota usage endpoints to confirm the limit and reset date
  3. Use a self-hosted/external LLM (e.g. the LiteLLM proxy or your own API key) instead of Budibase AI credits where supported
  4. Catch AICreditsExhaustedError specifically (check code USAGE_LIMIT_EXCEEDED) and show a friendly upgrade prompt

Example fix

// before: generic handling loses the signal
try { await runAiPrompt(prompt) } catch (err) { console.log(err) }
// after
try {
  await runAiPrompt(prompt)
} catch (err: any) {
  if (err?.code === "USAGE_LIMIT_EXCEEDED") {
    throw new Error("AI credits exhausted — upgrade your plan or wait for reset")
  }
  throw err
}
Defensive patterns

Strategy: try-catch

Validate before calling

const exceeded = await quotas.usageLimitIsExceeded({
  name: MonthlyQuotaName.BUDIBASE_AI_CREDITS,
  type: QuotaUsageType.MONTHLY,
  usageChange: 1,
})
if (exceeded) { /* skip AI call, show upgrade prompt */ }

Type guard

function isAICreditsExhausted(err: unknown): err is AICreditsExhaustedError {
  return err instanceof AICreditsExhaustedError
}

Try / catch

try {
  await runAiPrompt(prompt)
} catch (err) {
  if (isAICreditsExhausted(err)) {
    // show billing-cycle limit UI; no retry until reset
  } else { throw err }
}

Prevention

When it happens

Trigger: Any AI-powered feature call (AI config usage, AI-generated content) after the tenant consumed its monthly AI credit allowance; the +1 usageChange in usageLimitIsExceeded pushes total past the licensed value.

Common situations: Heavy use of AI assistance features (e.g. AI formulas, AI config generation) within one billing month; small plan with a low AI credit allocation; quota reset not yet processed at month rollover; shared tenant where teammates exhausted pooled credits.

Related errors


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