Error Codes
The error codes and messages the SDK produces, what each one means, and what to do about it.
Most SDK failures are a plain Error whose message says what went wrong. A handful carry a machine-readable code you can branch on. This page lists both: the codes first, then the messages you are most likely to see.
How errors surface
| Where | What you get |
|---|---|
| Hooks | An error field (usually a string) on the hook result, for example useConnectedAgents(), PricingPage |
| Async calls you make | A rejected promise with an Error; read err.message, and err.code where this page lists one |
onError in the server config | (error, { method, path }) runs for every failed API request, before the error is thrown to you |
onUnauthorized | On the *Api client classes (WorkspaceApi and siblings): runs when a request gets a 401 |
useSessionEnded() | Why a company ended the session (401 session_ended), reported before onUnauthorized runs |
isReauthRequired(error) | A change that needs a recent proof of who the person is (403 reauth_required); the session is kept |
| Tracking | An sdk_error event with component, action and code, never the message |
import BuildBase from '@buildbase/sdk';
const bb = BuildBase({
serverUrl: process.env.BUILDBASE_SERVER_URL!,
orgId: process.env.BUILDBASE_ORG_ID!,
onError: (error, { method, path }) => {
console.error(`[buildbase] ${method} ${path}`, error.message);
},
});Aborted requests (an AbortError, from your own AbortController or an unmounted component) are treated as cancellations: the SDK does not report them, and you can ignore them too.
Error codes
Credits
| Code | When it happens | What to do |
|---|---|---|
INSUFFICIENT_CREDITS | useConsumeCredits() or bb.credits.consume() gets a 402: the balance is too low | Read err.available and err.requested to explain the gap, then offer openCreditStore() or a plan change |
HOLD_NOT_OPEN | A 409 on settling or releasing a hold that is no longer open. The body's status says what became of it: settled, released or expired (its ttlSeconds ran out) | After released or expired the credits are back: reserve again if the work still needs them |
AUTO_TOP_UP_INCOMPLETE | A 400 on switching auto top-up on with no threshold or no pack | Send both |
PACKAGE_CURRENCY_UNAVAILABLE | A 400 on switching auto top-up on with a pack that has no price in the workspace's currency | Choose a pack priced in that currency |
PACKAGE_VERSION_CHANGED | A 409 on agreeing to a pack's new terms (acceptVersion) when the version it names is no longer the one on sale: another was published since the payer read them | Read the setting again (versionOnSale) and agree to what it shows |
AGREEMENT_PAYER_ONLY | A 400 on the console's support route for a workspace's auto top-up when it sends acceptVersion: only the payer agrees to a pack's new terms | Ask the payer to agree from their own billing settings |
TAX_REQUIRES_HOSTED_CHECKOUT | A 409 on switching auto top-up on in an organization that collects tax: a saved-card charge does not compute tax yet | Sell packs through checkout instead |
AUTO_TOP_UP_OFF | A 403 on switching auto top-up on, or changing one that is on, when your organization does not offer it to its customers (Settings > General, card Automatic credit top-up) | Buy packs through checkout, or switch the top-up off |
MONTHLY_CAP_ABOVE_LIMIT | A 400 on setting an auto top-up's monthlyCap above the most top-ups a month your organization allows | Choose a cap within the limit the message names |
CREDIT_PACKAGE_IN_USE | A 409 on deleting a credit pack (DELETE /api/subscriptions/credit-packages/:id) while something still holds it: a plan version names it, an enabled auto top-up buys it, or credits bought or granted from it are still unspent. The body's inUse says which | Switch the pack off (Active off) instead: that stops new sales, keeps what holders bought, and lets their auto top-ups keep buying it |
import {
useConsumeCredits,
useSaaSAuth,
useSaaSWorkspaces,
} from '@buildbase/sdk/react';
function Generate() {
const { currentWorkspace } = useSaaSWorkspaces();
const { consumeCredits } = useConsumeCredits(currentWorkspace?._id);
const { openCreditStore } = useSaaSAuth();
async function run() {
try {
await consumeCredits({ amount: 10, description: 'AI generation' });
} catch (err: any) {
if (err.code === 'INSUFFICIENT_CREDITS') {
alert(
`You have ${err.available} credits, this needs ${err.requested}.`
);
openCreditStore();
return;
}
throw err;
}
}
return <button onClick={run}>Generate</button>;
}Billing and checkout
Each code is the code field of the server's JSON answer, beside its HTTP status.
| Code | Status | When it happens | What to do |
|---|---|---|---|
TAX_SETTING_UNAVAILABLE | 503 | A checkout (a plan, a person's own plan, a credit pack or an add-on) could not read the organization's tax setting. Nothing was created or charged. The answer carries Retry-After | Retry after the Retry-After seconds; the same request can succeed |
STRIPE_PUBLISHABLE_KEY_MISSING | 400 | A checkout inside your app was asked for, and no Stripe publishable key is saved with the payment credentials. Refused before any session is made | Save the pk_live_... or pk_test_... key under Billing > Credentials, or use the hosted checkout |
STRIPE_KEY_MODE_MISMATCH | 400 | An embedded checkout, and the saved publishable key is from the other mode (live or test) than the secret key | Replace the publishable key with the one from the same mode and Stripe account |
STRIPE_NOT_CONNECTED | 409 | The organization has not connected Stripe, so a checkout cannot be made: a workspace's plan, a person's own plan or a credit pack. Nothing was sent to Stripe. The message your end user can be shown is "Payments are not set up for this app yet." | Your end user cannot fix it: show the message. Connect Stripe under Billing > Credentials |
STRIPE_CATALOG_SYNCING | 409 or 400 | A checkout (a workspace's plan or a person's own) or a plan change reached a plan whose Stripe prices another run of the price sync is making at that moment, such as the sync that starts when Stripe is connected. 409 from a checkout, 400 from a plan change or its preview. Nothing was created or charged. The message your end user can be shown is "This plan's prices are still being set up. Try again in a moment." | Show the message and let them try again: the prices are made within moments |
IDEMPOTENCY_KEY_REUSED | 409 | A billing write (a checkout, a plan change, a cancel, a pause, a purchase or a portal link) sent an Idempotency-Key that this person already used for a different request, or the checkout that key opened has closed and the one fresh session it may make has closed too. Nothing new was created or charged. The same key sent again with the same request gets the first answer back | Send a new key for a new action. Reuse a key only to retry the same action |
PURCHASE_SETTLING | 409 | A recurring add-on purchase arrived while another purchase of the same add-on is paid and still being added to the subscription, usually for seconds. Nothing was charged. Carries reason: "purchase_settling", the earlier purchaseId, retryAfterSeconds and a Retry-After header. The earlier purchase sent again is not refused: it gets its first answer back (a retry or a new purchase) | Send the same request again after retryAfterSeconds. To buy the same quantity twice in a row, send each purchase with its own Idempotency-Key |
SUBSCRIPTION_CURRENCY_MISMATCH | 400 | A checkout, a plan change or its preview named a currency other than the one the workspace (or person) is already billed in: Stripe bills one customer in one currency. Nothing was created | Leave currency out, or send the currency the subscription is billed in |
PLAN_CURRENCY_UNAVAILABLE | 400 | The plan has no price in the currency it would be billed in. That is the currency the workspace is locked to, else the currency asked for, else the first of the organization's billing currencies (stored in alphabetical order) that the plan is priced in, and a plan priced in none of them is refused too. BuildBase never picks a currency outside the organization's billing currencies | Choose a plan priced in that currency, or add a price in it to the plan version |
FEATURE_NOT_IN_PLAN | 402 | Your app's own BuildBase plan does not include the capability the call needs, such as enterprise single sign-on. The body names it in feature. It is never about your end user's plan: a workspace's or person's plan refuses with PLAN_LIMIT_REACHED | Your end user cannot fix it. Show a neutral message and upgrade your BuildBase plan. The SDK refreshes its entitlements on this answer |
SEAT_LIMIT_REACHED | 402 or 403 | 402 with currentUserCount and limit: members plus pending invitations fill the workspace's seats, on an invitation or anything else that would take a seat. 403 with no counts: your app's BuildBase plan has reached its member ceiling for the workspace | On a 402, free a seat or move the workspace to a plan with more. On a 403, the end user cannot fix it: show a neutral message, and raise your BuildBase plan |
PLAN_LIMIT_REACHED | 402 | A workspace or a person has reached a plan limit, such as creating one more item than the plan allows. The body carries limit, current and limitSlug, so a screen can show a meter | Remove one, or move to a plan with more. A limit you marked as an end-user boundary answers 403 CEILING_REACHED instead (below) |
QUOTA_EXHAUSTED | 402 | Recording usage past a metered quota that allows no overage (no paying for extra use), or while the workspace is on a trial. Nothing is recorded. The body carries quotaSlug and resetsAt, when the allowance starts again. It was a 400 before this platform release | Branch on err.status === 402: @buildbase/sdk 0.0.90 and earlier drop the body's code, and 1.0.0 keeps it. Offer an upgrade, or say when the quota resets. See Quotas |
PLAN_REQUIRED | 402 | Your app requires a plan before a workspace is used (Require a plan under New workspaces), and this workspace has none. Answered when it records usage or spends credits; reading, members, settings and billing stay open. The body carries upgradeTarget: "workspace" and next, the routes that end it: the plans, selecting a free plan and starting a checkout | Show your plans, or let the SDK's plan picker do it. An agent can read next, choose a free plan itself, or hand a person the checkout link for a paid one |
RETENTION_ALREADY_USED | 409 | Accepting a retention offer a second time: each subscription gets it once | Show the answer; carry on with the cancellation |
RETENTION_OFFER_CHANGED | 400 | The retention offer changed after it was shown | Read the offer again with getRetentionOffer() and show the new one |
RETENTION_OFFER_UNAVAILABLE | 400 | No retention offer applies to this subscription now | Carry on with the cancellation |
CANCEL_NOW_OFF | 403 | A customer asked to end their subscription now (POST .../subscription/cancel-now, a workspace's or a person's own), and the organization lets customers cancel only at the end of the period (Ending a subscription now). Nothing changed | Offer the cancel at the end of the period instead: the subscription read's capabilities.cancelNow.enabled is false |
INTERVAL_SWITCH_OFF | 403 | A plan change, its preview or a move of the workspace plan to the person named another billing interval than the subscription's own, and the organization turned off customers' interval switch (Switching interval). Nothing changed | Offer plans on the current interval only: the subscription read's capabilities.intervalSwitch.enabled is false. A change that names no interval keeps the subscription's |
NO_PLANS_AVAILABLE | 404 | The organization sells no plans yet: no pricing group has a published version | From @buildbase/sdk 1.0.0 this is not a failure: usePlanGroupVersions and usePlanGroup answer it with no plans and error: null, and Plan & Billing shows its empty state. SDK 0.0.90 reports it as a failed load, in error. Publish a pricing group version |
PLAN_VERSION_NOT_FOUND | 400 | Selecting a free plan (select-free-plan, for a workspace or a person) named a planVersionId that does not exist, or that no pricing group offers to this workspace or person. The two answer the same on purpose, so a guessed id learns nothing | Pick a plan from the plans the catalog lists (usePlanGroupVersions) |
LAPSE_HELD | 409 | Selecting a free plan (select-free-plan, for a workspace or a person) after Stripe ended the paid plan for failed payments, while the organization keeps the lapse policy in force and the workspace or person is held read-only or suspended. Nothing changed | Subscribe to a plan again; the hold ends then, or when the organization's Move to Free after days have run |
FUTURE_VERSIONS_NOT_INCLUDED | 409 | Opting a lifetime add-on out of later versions, or back in (POST .../billing/add-ons/:grantId/future-versions), when the purchase was not sold with "includes future versions". reason is future_versions_not_included | Nothing to choose: the add-on keeps what it was sold |
NOT_HELD | 409 | The same choice on a lifetime licence that is no longer held: refunded, disputed or revoked. reason is not_held | Nothing to choose until it is held again, such as after a dispute is won |
RETURN_URL_DEFAULTED | 200 | Not an error: a returnWarning on the answer of a checkout (a plan, a credit pack, an add-on, an upgrade or a card setup) sent with no successUrl, when no checkout return page is set and none of the organization's apps has a public https address, so the buyer returns to the old default instead of your app. Every checkout answer names where the buyer lands in landingUrl | Send successUrl and cancelUrl, set the checkout return page (Settings, Organization, After checkout), or add your app's https address as a redirect URL of its app client |
RETURN_URL_REQUIRED | 400 | The same checkout once the platform stops falling back to the old default. Nothing is created | The same as for RETURN_URL_DEFAULTED |
PAID_GRANTS_PRESENT | 409 | Deleting a workspace, or a person deleting their account, while it still holds what was paid for (unexpired one-time or lifetime add-ons, consumable units, credits) and the organization blocks such deletes (addOns.deleteWithGrants: 'block'). The body lists what is held; an account delete also carries reason: "paid_grants_present". Nothing was deleted | Use, refund or let them expire first. Not a 402: nothing to buy |
The credit codes are under Credits above. An email sender missing when an invitation is sent is NO_SENDER_CONFIGURED, under Server API keys.
Catalog editor validation
The catalog editor's checks for add-on offers, offer items and plan versions. Each is a 400, never a 402: none is about a plan's limits. The rules live in one shared validator that the server, the console's add-on editor and the blueprint all run, so the same offer gets the same answer wherever it is written. Codes are added, never renamed.
Add-on offers. Sent by the offer routes: create (POST /api/subscriptions/offers), edit (PATCH /api/subscriptions/offers/:id), version edit (PATCH /api/subscriptions/offers/:id/versions/:versionId) and publish (POST /api/subscriptions/offers/:id/publish and POST /api/subscriptions/offers/:id/versions/:versionId/publish). The answer keeps the human message and the problems list, and adds the first refusal's code and every refusal in refusals: [{ code, path, message }], where path is a JSON pointer into the offer body (such as /items/0/mode). Refusals about an item carry itemSlug, and price refusals carry currency (and interval). Nothing is saved or published.
| Code | Status | When it happens | What to do |
|---|---|---|---|
OFFER_NO_ITEM | 400 | The offer grants no item, and it is not a seat class (an offer with autoQuantity, which may grant none) | Add at least one item |
OFFER_VALIDITY_REQUIRED | 400 | A one-time offer without validityDays as a whole number of days of at least 1 | Set validityDays to 1 or more |
OFFER_VALIDITY_ONE_TIME_ONLY | 400 | validityDays was sent on a shape other than one-time | Remove validityDays, or make the offer one-time |
OFFER_QUOTA_SHAPE | 400 | A quota item on a one-time or lifetime offer: a quota is granted only by a recurring or a consumable offer | Sell the quota as a recurring or consumable offer, or remove it |
OFFER_CONSUMABLE_QUOTA_ONLY | 400 | A feature or limit item on a consumable offer, which carries quota items only. GRANT_CONSUMABLE_KIND is listed beside it | Remove the item, or choose another shape |
OFFER_QUOTA_FLOOR | 400 | A quota item granted with mode: "floor". GRANT_QUOTA_FLOOR is listed beside it | Grant the quota with another mode |
OFFER_CONSUMABLE_TERM_ONLY | 400 | consumeOrder or rolloverCapUnits on a shape other than consumable | Remove the field, or make the offer consumable |
OFFER_ROLLOVER_CAP_INVALID | 400 | A consumable offer's rolloverCapUnits is not a whole number of units, 0 or more. The route's request schema usually refuses this first, with a plain 400 and no code | Send a whole number, 0 or more |
OFFER_FUTURE_VERSIONS_LIFETIME_ONLY | 400 | includesFutureVersions is true on a shape other than lifetime: it promises every later version to a licence that never ends | Turn it off, or make the offer lifetime |
OFFER_DURING_TRIAL_RECURRING_ONLY | 400 | duringTrial on a shape other than recurring | Remove duringTrial, or make the offer recurring |
OFFER_SEAT_CLASS_RECURRING_ONLY | 400 | A seat class (autoQuantity) on a shape other than recurring | Make the offer recurring, or remove autoQuantity |
OFFER_SEAT_CLASS_WORKSPACE_ONLY | 400 | A seat class on an offer sold to a person: it counts a workspace's members, and a person's plan has no seats | Sell the seat class to workspaces, or remove autoQuantity |
OFFER_SEAT_RULE_INVALID | 400 | The seat class's seatCountRule cannot be read: not an object, a role list that is not a list of role names, or a switch that is not true or false | Fix the rule's shape |
OFFER_SEAT_RULE_ROLE_CONFLICT | 400 | The seat count rule both includes and excludes the same role | Keep each role in one list only |
OFFER_SEAT_RULE_NO_ROLE | 400 | The seat count rule's includeRoles names no role, so no member would take a seat | Name at least one role, or remove includeRoles to count every role |
OFFER_PLAN_PAYER_MISMATCH | 400 | appliesToPlans names a plan that is not sold to the offer's payer type (workspace or person). Checked by the server only | Name plans sold to the same payer type as the offer |
OFFER_ITEM_DUPLICATE | 400 | One item is granted twice by the same offer | Grant each item once |
OFFER_ITEM_NOT_DECLARED | 400 | No item with this slug and kind is declared in the payer's scope (workspace or person). Checked by the server only | Declare the item for that payer, or fix the slug or kind |
OFFER_CURRENCY_UNSUPPORTED | 400 | A price is in a currency the platform does not bill in | Price the offer in a supported currency |
OFFER_PRICE_ONE_TIME_INVALID | 400 | A one-time, lifetime or consumable offer has no one-time price that is a whole number of minor units above 0 | Send prices.oneTime as a whole number above 0 |
OFFER_PRICE_RECURRING_ONCE | 400 | A recurring offer was priced once (oneTime): it is priced per interval | Price it monthly, quarterly or yearly |
OFFER_PRICE_RECURRING_NO_INTERVAL | 400 | A recurring offer's price names no interval | Add at least one interval price |
OFFER_PRICE_INTERVAL_INVALID | 400 | A recurring interval price is not a whole number of minor units above 0. The route's request schema usually refuses this first, with a plain 400 and no code | Send each interval price as a whole number above 0 |
OFFER_PUBLISH_PRICE_MISSING | 400 | Publish: the organization bills in a currency the offer has no price in | Add a price in every billing currency, then publish |
OFFER_PUBLISH_INTERVAL_MISSING | 400 | Publish: a published plan for the same payer type is sold on an interval that this recurring offer has no price for, in that currency | Add a price on that interval, then publish |
OFFER_PUBLISH_NO_PRICE | 400 | Publish: the organization names no billing currency, and the offer has no price in any currency | Add a price in at least one currency |
OFFER_PUBLISH_UNIT_BILLED | 400 | Publish: an item is the unit a published plan bills by, so a grant of it would not change what is billed | Remove the item from the offer |
OFFER_CONSOLE_GATE_OFF | 400 | Publish in BuildBase's own management tenant only: the gate for a slug the offer grants is off or in shadow, so the grant would change nothing | Not sent for your app's offers |
OFFER_CONSOLE_CENTRAL_GATE_UNCONFIRMED | 400 | Publish in BuildBase's own management tenant only: an offer of team-members, before central's gate is recorded as armed | Not sent for your app's offers |
OFFER_CONSOLE_STORAGE_PACK | 400 | Publish in BuildBase's own management tenant only: storage sold as a consumable pack that counts down | Not sent for your app's offers |
OFFER_CONSOLE_STORAGE_UNCOUNTED | 400 | Reserved; not sent now. Publish in BuildBase's own management tenant would send it if storage were sold before anything counted it, and storage is counted | Not sent for your app's offers |
OFFER_CONSOLE_PACK_NOT_ORG_USAGE | 400 | Publish in BuildBase's own management tenant only: a consumable pack of something other than a quota recorded through org usage | Not sent for your app's offers |
Offer items as grant rows. Every item of an offer is also checked as the grant row a purchase of one unit would write, and those refusals come back in the same offer answer with these codes and a path such as /items/0/quantityPerUnit. The console's add-on editor words them in its own terms. When the grant service itself refuses a row (an admin grant, a version move's grant), it answers 400 GRANT_INVALID with the sentences in problems, not these codes.
| Code | Status | When it happens | What to do |
|---|---|---|---|
GRANT_ITEM_MISSING | 400 | An item row names no item. The offer routes' request schema refuses an empty slug first, so the console editor shows this one before a save | Pick the item for every row |
GRANT_QUANTITY_INVALID | 400 | quantityPerUnit is not a whole number, or is below -1 (unlimited). The route's request schema usually refuses this first, with a plain 400 and no code | Send a whole number, or -1 for unlimited |
GRANT_FEATURE_QUANTITY | 400 | A feature item with a quantity other than 1: a feature grant only turns the feature on | Set the quantity to 1 |
GRANT_QUOTA_FLOOR | 400 | A quota item with mode: "floor". Listed beside OFFER_QUOTA_FLOOR | Grant the quota with another mode |
GRANT_CONSUMABLE_KIND | 400 | A consumable offer grants an item that is not a quota. Listed beside OFFER_CONSUMABLE_QUOTA_ONLY | Grant quota items only on a consumable offer |
GRANT_REMAINING_INVALID | 400 | A consumable offer's units per purchase are not a whole number, 0 or more, such as -1 | Send a whole number of units |
GRANT_CONSUMABLE_UNLIMITED | 400 | A consumable offer grants -1 (unlimited) units: a pack holds units | Send a number of units |
GRANT_WINDOW_INVALID | 400 | Reserved; not sent yet. The shared rule refuses a grant that ends before it starts, but no route answers with this code: an offer item has no dates, and the grant service answers GRANT_INVALID | Nothing to handle yet |
Plan versions and pricing groups. Sent when a plan version cannot be sold to the payer (workspace or person) of the group it is published in: publishing a plan version that already sits in a published group (POST /api/subscriptions/plans/:planId/versions/:id/publish), and publishing a pricing group version (POST /api/subscriptions/groups/:groupId/versions/:id/publish). The answer carries code, field, the item slug where there is one, and message. Nothing is published. Two related reasons keep their older codes: a sponsored grant naming no user-scope item is SCOPE_MISMATCH, and a plan already in a group of the other payer is SUBJECT_KIND_MISMATCH.
| Code | Status | When it happens | What to do |
|---|---|---|---|
PLAN_SCOPE_GRANT_KIND_MISMATCH | 400 | A sponsored grant (ownerGrants or memberGrants) names a user-scope item as another kind than the item is | Use the item's own kind in the grant |
PLAN_SCOPE_MEMBER_QUOTA_PERSON | 400 | A quota counted per member on a plan sold to a person, who has no members | Count the quota on the person instead |
PLAN_SCOPE_MEMBER_QUOTA_OVERAGE | 400 | A quota counted per member that bills overage: a per-member allowance is hard | Turn overage off, or fall back to a shared pool |
PLAN_SCOPE_MEMBER_QUOTA_POOL_UNSIZED | 400 | A per-member quota falls back to a shared pool with no size | Set poolIncluded to 0 or more, or -1 for no limit |
PLAN_SCOPE_INSTALLATION_WORKSPACE | 400 | Per-installation pricing on a plan sold to a workspace: installations belong to a person | Price per seat, or move the plan to a group sold to people |
PLAN_SCOPE_SEAT_PERSON | 400 | Per-seat pricing on a plan sold to a person, who has no seats | Turn seat pricing off; per installation is the unit a person's plan takes |
PLAN_SCOPE_CREDIT_GRANT_PERSON | 400 | A credit grant on a plan sold to a person: such plans cannot grant credits yet | Turn the credit grant off, or sell the plan to workspaces |
Catalog
The console's catalog routes (plans, plan versions, pricing group versions, add-on offers and credit packages) answer these when an edit would change what customers already bought, or take away a version or an offer that an open move or grant still names, when a version of an add-on offer or a credit package is drafted, published or deleted out of turn, when archiving a plan would break something live, and when a change would put an archived plan back on sale.
| Code | Status | When it happens | What to do |
|---|---|---|---|
VERSION_REQUIRED | 409 | An edit to a published plan version, pricing group version or add-on offer would change what it sold: its items, limits, quotas, prices, grants, credit grant or trial; a group version's plans; an offer's items, shape, term, caps or trial answer. Also an edit to a credit package something holds (a published plan version grants it, an enabled auto top-up buys it, or it was bought or granted) that would change its credits, validity or a priced currency's amount (PATCH /api/subscriptions/credit-packages/:id, which answered CREDIT_PACKAGE_TERMS_LOCKED before package versions, and still carries field and termsLock), and an edit to a published version of a package (PATCH /api/subscriptions/credit-packages/:id/versions/:versionId). fields names them and newVersion is the call that makes a new version instead. A field sent with the value it already holds passes, and so does a currency a held package is not priced in yet | Make a new version (newVersion: POST with baseVersionId, for a plan version, an add-on offer or a credit package), change it there and publish it |
CATALOG_ITEM_SOLD | 409 | An edit to a subscription item, or to the workspace feature it maps to, while a published plan version, a published add-on offer or a held grant sells it, and the edit would change what holders bought: the item's slug, workspace feature, count rule, link, claim policy or end-user boundary, or archiving it; the feature's enabled, subscriptionManaged or defaultValue, or archiving it. fields names them and soldIn counts what sells it. A field sent with the value it already holds passes | Create a new item for the change and publish new plan versions with it |
VERSION_MOVE_PENDING | 409 | Archiving a plan version, an add-on offer or an add-on offer's version that an open move still names: a version move of holders from or onto the version, a move of the offer's holders to its current prices or to a newer version, a grant to the version's or the offer's holders, or a lifetime offer's new version on its way to the licences that include future versions. Open is awaiting confirmation, queued or running, or cancelled with holders it had started still being settled. moveId and moveKind name the move | Cancel the move or grant, or let it complete, then archive the version or offer |
VERSION_MOVE_PREVIEW_STALE | 409 | Starting or confirming a version move, or publishing a plan version, an add-on offer version or a credit package version that starts one, whose preview no longer matches: a version, the plan's, offer's or package's version move setting or the move's terms changed since the preview the request names. Nothing was published or started | Preview again in the console and confirm what it shows |
VERSION_MOVE_NOT_OPEN | 409 | Confirming a version move that is no longer awaiting confirmation, or cancelling one that is already completed or cancelled. moveState names where it stands | Reload the move; there is nothing left to confirm or cancel |
CREDIT_PACKAGE_NOT_PUBLISHED | 409 | A version route of a credit package nothing holds yet (draft, edit, publish or delete a version): its version 1 is a draft, edited through the package itself, until a sale, a published plan version or an auto top-up holds its terms | Edit the package (PATCH /api/subscriptions/credit-packages/:id) |
DRAFT_EXISTS | 409 | A second draft version of a credit package or an add-on offer while one is open. draftVersionId names it | Edit, publish or delete that draft first |
VERSION_REPLACED | 409 | A publish of a version of a credit package or an add-on offer that a later version replaced: what bought it keeps it, and it is never put back on sale | Draft a new version from it (newVersion) and publish that |
VERSION_PUBLISHED | 409 | A delete of a published version of a credit package, current or replaced: what bought it or was granted it holds it, so it is kept. Only a draft is deleted | Leave it; to stop selling the package, switch it off (Active off) |
CREDIT_PACKAGE_CHANGED | 409 | A credit package edit, or a version's edit, publish or delete, lost a race to another request (another version was made current, or the draft was published meanwhile). Nothing of it was kept; a Stripe price minted for a publish is reused by the next one | Read the package again and retry |
PLAN_ON_SALE | 409 | Archiving a plan (PATCH /api/subscriptions/plans/:id with archived: true, or DELETE) while the current published version of a pricing group that is not archived lists one of its versions: the pricing page would offer a plan nobody can buy. groups names each group and its version | Publish a new version of the group without the plan, then archive it. Its subscribers keep it either way |
PLAN_IS_DEFAULT_FREE | 409 | Archiving a plan whose version is the free plan new workspaces start on and fall back to when a paid plan ends (the organization's freemium workspace onboarding default). planVersionId names it | Choose another default plan, then archive it |
PLAN_IS_ONBOARDING_TRIAL | 409 | Archiving the plan new workspaces start a no-card trial of (the organization's workspace onboarding setting, in trial mode) | Choose another trial plan, or another mode, then archive it |
PLAN_ARCHIVED | 409 | Something would put an archived plan back in front of new customers: publishing a pricing group version that lists a version of it, unarchiving a pricing group whose current version lists one, or setting a version of it as the freemium workspace onboarding default (PATCH /api/organizations/settings/config, with path). plans names each one. Nothing was changed | Unarchive the plan, or take its version out of the group (publish a group version without it), or choose another free plan |
Billing versioning switches
Each part of versioned billing can be turned off for one organization in the console (the Billing versioning card in Settings > General, see Billing versioning switches). While one is off, the console's catalog routes answer these, with phase naming the switch. Nothing was started, published or changed; turn the switch back on and the same request goes through.
| Code | Status | When it happens | What to do |
|---|---|---|---|
VERSIONING_MOVES_OFF | 409 | Version moves are off: previewing, starting or confirming a move (a plan's, an add-on's price or versions, a credit package's, a grant to holders, a lifetime add-on's new version), a console publish that asks to start one, or retrying a holder a running move waits on. Reading moves, cancelling one and leaving a holder where they are still work | Publish without moving customers, or turn version moves back on; held moves then carry on |
VERSIONING_OFFERS_OFF | 409 | Add-on and credit package versions are off: publishing a new version of an add-on offer or a credit package, or a lifetime add-on that includes future versions. Drafts stay editable, publishing the current version again still works, and what customers hold keeps working | Keep the draft, or turn add-on and credit package versions back on and publish it |
Add-on upgrades
The quote and the purchase of an add-on upgrade (GET and POST /api/v1/public/workspaces/:workspaceId/billing/add-ons/:grantId/upgrade, and /api/v1/public/me/billing/add-ons/:grantId/upgrade for a person) answer these. Nothing is charged or written when one comes back. None is a plan refusal, and none is a 402.
| Code | Status | When it happens | What to do |
|---|---|---|---|
ADDON_UPGRADE_GRANT_NOT_FOUND | 404 | No grant with that id is held by this workspace or person | Read the held rows again (useWorkspaceAddOns) and send one of theirs |
ADDON_UPGRADE_ALREADY_CURRENT | 409 | The holder already holds the version on sale. Asked again, it answers the same | Nothing to do: hide the upgrade |
ADDON_UPGRADE_NOT_ELIGIBLE | 409 | The grant cannot be upgraded. reason says why: shape_not_upgradable (a pack or a recurring add-on), not_a_purchase (an operator's or a plan's grant), not_active (refunded, taken back or ended), not_on_sale (the add-on is archived or off sale), term_ended (a pass whose new term, counted from when it started, is already over), quantity_invalid (the new version sells fewer units at once than are held), currency_unpriced (no price in the currency the holder pays in), outside_applies_to_plans | Show the message; the holder keeps what they hold |
ADDON_UPGRADE_PENDING | 409 | A payment is still settling: the purchase's own, or an upgrade of it already paid and not yet applied | Wait for the payment to land, then read the add-ons again |
ADDON_UPGRADE_INCLUDED | 409 | A lifetime licence sold with "includes future versions": every later version reaches it at no charge, so it is never upgraded by paying. A holder who opted out gets this too, with optedOut: true: opting back in brings the licence to the current version for nothing. Asked again, it answers the same | Hide the upgrade. To take the current version, opt back in |
IDEMPOTENCY_KEY_REUSED | 409 | The purchase's requestId was used before for a different upgrade, or its earlier session expired twice | Send a new requestId |
Subscription state
A plan change, cancel, pause, resume, add-on change or other subscription operation that the subscription's current state does not allow answers 400 with the message and one of these codes, from a workspace's subscription routes and a person's own (/me/subscription). Moving a workspace's plan to a person (move-to-user) answers 409 instead, with SUBSCRIPTION_PAUSED when the subscription is paused. The code names the state, so branch on it rather than on the words: the remedy is the state's.
| Code | When it happens | What to do |
|---|---|---|
NO_SUBSCRIPTION | There is no subscription to change | Start a checkout for a plan |
SUBSCRIPTION_ACTIVE | The subscription is active and the operation needs another state (a resume, say) | Nothing to do; the subscription is already running |
SUBSCRIPTION_CANCELING | The subscription is set to cancel at the end of its period | Reactivate it, then retry |
SUBSCRIPTION_TRIALING | The subscription is in its trial and the operation waits for it to end | Retry after the trial converts |
SUBSCRIPTION_PAST_DUE | An invoice is unpaid, including while Stripe retries it | Pay the open invoice or update the card, then retry |
SUBSCRIPTION_PAUSED | The subscription is paused, or a pause is scheduled | Resume it, then retry |
SUBSCRIPTION_INCOMPLETE | The first payment has not completed | Finish the payment, or start the checkout again |
SUBSCRIPTION_SUSPENDED | Payment retries ran out on an unpaid invoice and access is suspended | Pay the open invoice or update the card |
An upcoming invoice with nothing to show is not an error: it answers kind: 'none' with a reason of cancels_at_period_end, no_subscription or trial_needs_payment_method (a trial started without a card ends with no invoice, and converts only if a payment method is added before it ends). See the upcoming invoice.
In-app card payment
Saving a card and paying an open invoice inside your app (POST .../billing/payment-method/setup, POST .../billing/payment-method/default with setupIntentId, and POST .../subscription/invoices/:invoiceId/pay, for a workspace and for a person under /me) answer these. See Billing. None is a 402.
| Code | Status | When it happens | What to do |
|---|---|---|---|
PAYMENT_METHOD_PAID_BY_ANOTHER | 409 | Another account pays for this plan, so its card is not changed here | Change the card from the paying account's billing |
SETUP_INTENT_NOT_FOUND | 404 | The setupIntentId is not this workspace's or person's, was not made in the app, or is gone | Start the card setup again |
SETUP_INTENT_NOT_SUCCEEDED | 409 | The card was not confirmed: 3-D Secure left half way, or a decline. Carries setupIntentStatus | Add the card again, or use another card |
INVOICE_NOT_FOUND | 404 | The invoice is not one of this subject's own subscription | Read the invoices again and pay one of those |
INVOICE_NOT_OPEN | 409 | The invoice is voided or a draft, so there is nothing to pay. Carries invoiceStatus. A paid one answers paid: true instead | Nothing to pay |
PENDING_CHANGE_EXPIRED | 409 | The plan change this invoice pays for expired before it was paid. Carries pendingUpdateExpiresAt | Start the change again |
PAYMENT_METHOD_NOT_FOUND | 404 | The paymentMethodId is not a card on the invoice's customer | Add the card again, or pay with the default card |
CARD_DECLINED | 400 | Stripe declined the card. Carries paymentError: true and declineCode when Stripe gave one | Ask for another card |
Workspace members
Removing a member, or leaving, is DELETE /api/v1/public/workspaces/:workspaceId/users/:userId (removeUser). Any member may leave with their own id; see Leaving a workspace.
Changing a member's role is PATCH /api/v1/public/workspaces/:workspaceId/users/:userId (updateUser). The owner's role is not changed through it; see Required permissions.
| Code | Status | When it happens | What to do |
|---|---|---|---|
WORKSPACE_OWNER_CANNOT_LEAVE | 409 | The workspace's owner, the person who created it, tried to leave. Ownership cannot be handed to another member | Delete the workspace instead |
WORKSPACE_OWNER_ROLE_FIXED | 409 | Someone, the owner included, tried to change the role of the workspace's owner. The owner holds every permission whatever their role says | Change another member's role instead |
PAYER_STILL_PAYS | 409 | The person leaving or being removed pays for the workspace's subscription with their own card. See Payers | Move billing first, or cancel the subscription |
Workspace features
A workspace changes its own features with PATCH /api/v1/public/workspaces/:workspaceId/features (updateFeature). Only a user-managed feature is the workspace's to change; see Feature flags.
| Code | Status | When it happens | What to do |
|---|---|---|---|
FEATURE_NOT_USER_MANAGED | 403 | Every feature the request names follows the plan or is set by the app's team, listed in features. Beside ones it can change, they are skipped and named in ignoredFeatures | Hide the toggle for those features; change them in the console or the plan instead |
Workspace mode
Changing the organization's workspace mode (PATCH /api/organizations/settings/workspace-mode; see Workspace settings) can be refused because of the organization's own data. A refusal that is the plan's is a 402 from Billing and checkout.
| Code | Status | When it happens | What to do |
|---|---|---|---|
PERSONAL_MODE_OWNERS_OVER_LIMIT | 409 | Switching to Personal mode, one workspace per person, while someone owns more than one. Carries ownersOverLimit and owners (the first few, with their workspaces) | Move or delete the extra workspaces, then switch |
Payers
When someone else pays for a workspace, the checkout and transfer-payer are checked before anything reaches Stripe, and a member who pays cannot leave or be removed until billing moves. A refusal carries one of these codes. None is a plan refusal, and none is a 402.
| Code | Status | When it happens | What to do |
|---|---|---|---|
PAYER_NOT_ALLOWED | 403 | The caller may not spend the payer's money: a person pays only as themselves, and a workspace pays only for someone holding its billing-manage permission | Pay as the signed-in person, or as a workspace they manage billing for |
PAYER_NOT_FOUND | 404 | The payer names no workspace or person in the organization | Check the payer's type and id |
PAYER_SUBJECT_KIND | 400 | A person's own plan named another payer. Only a workspace is paid for by someone else | Drop payer from a person's checkout |
PAYER_IS_PAID_FOR | 409 | The payer is a workspace someone else pays for. One level only | Choose a payer that pays for itself |
SUBJECT_IS_PAYER | 409 | The workspace pays for others, so it cannot be paid for | Let it pay for itself |
PAYER_CHILD_LIMIT | 409 | The payer already pays for maxChildren workspaces | Choose another payer, or raise maxChildren (PATCH /api/organizations/settings/payers) |
PAYER_CURRENCY_MISMATCH | 409 | The payer is billed in another currency: a Stripe customer holds one | Choose a payer billed in the plan's currency |
PAYER_METERED_OVERLAP | 409 | Another plan this payer pays for already bills overage on the same quota | Choose another payer, or a plan without that overage |
NO_PAID_SUBSCRIPTION | 409 | transfer-payer on a subscription with no Stripe subscription to move | Nothing to move; check out with the new payer instead |
SAME_PAYER | 409 | transfer-payer to the payer that already pays | Nothing to do |
TRANSFER_NOT_POSSIBLE | 409 | transfer-payer while the subscription is trialing, paused, past due, renews within the hour, or holds recurring add-ons | Try again after the trial or renewal, or once the add-ons are removed |
PAYER_STILL_PAYS | 409 | Removing a workspace member, or a member leaving, while their own card pays for the workspace's live subscription. Carries workspaceId and subscriptionId | Move billing to another member or back to the workspace with transfer-payer, or cancel the subscription, then try again |
A plan sold to the other kind of payer (a personal plan on a workspace checkout, or the reverse) is refused with 400 SUBJECT_KIND_MISMATCH. Two more codes are about who a plan is for:
| Code | Status | When it happens | What to do |
|---|---|---|---|
SCOPE_MISMATCH | 400 | Publishing a plan version or pricing group version with a sponsored grant that names no user-scope item. An item declared for the other payer answers it too, as a warning in the publish's warnings until the platform turns strict publish on, then as a 400 with mismatches | Grant only user-scope items, and sell each item to the payer it is declared for |
SELF_CHECKOUT_ONLY | 400 | A checkout link from the console or the admin checkout route (POST .../create-session) for a person, or a comp from nothing for a person with no paid subscription | A person checks out only as themselves, from their own billing (/me/subscription/checkout) |
Server API keys
Calls your backend makes with an organization API key (the server SDK, /api/v1/server) refuse with BuildBaseApiError, which carries the HTTP status and the server's code.
| Code | Status | When it happens | What to do |
|---|---|---|---|
API_KEY_REQUIRED | 403 | The route was called with a session token instead of an organization API key | Call it from your backend with an API key |
API_KEYS_SUSPENDED | 403 | BuildBase has suspended the organization's API keys: every request made with one is refused | Contact support to have them restored |
SENDING_SUSPENDED | 403 | BuildBase has suspended the organization's sending: a send is refused and nothing is queued | Contact support to have it restored |
NO_SENDER_CONFIGURED | 409 | The organization has no working email sender. An end user meets the same code as a 503 when a workspace invitation, a sign-in code or a magic link needs one | Connect a sender in the console under Messaging, Sender accounts |
SENDER_NOT_USABLE | 409 or 503 | The send names a sender whose account is inactive or archived. 503 where an end user's flow needs the mail, 409 for the organization's own sends | Turn the sender back on, or name another |
SENDER_VERIFICATION_FAILED | 400 | Saving an SMTP or SES sender, editing its SMTP settings, or a sender's test email, and the provider refused the credentials or the send. A test also carries stage | Fix the credentials the message points at, then save or test again |
IDEMPOTENCY_KEY_REUSED | 422 | The Idempotency-Key was used before with a different request | Use a new key for a new email |
IDEMPOTENCY_IN_PROGRESS | 409 | A request with this Idempotency-Key is still being processed | Retry shortly with the same key |
The send-specific codes (RECIPIENT_SUPPRESSED, SEND_LIMIT_REACHED, UNKNOWN_REFERENCE) are on Sending email.
The commerce writes (a refund, a part's charge, a subscription's cancel, resume or change, a booking's cancel, a shipment, a return, an affiliate or a grant action) answer the same two codes for an Idempotency-Key, on the server API, the SDK's seller routes and the console: 422 IDEMPOTENCY_KEY_REUSED when the key was used on that route with another body or another order, and 409 IDEMPOTENCY_IN_PROGRESS while the first request runs. The same key with the same request after it finished gets the first answer back, with Idempotent-Replayed: true (retrying a write safely).
Admin routes
The admin routes change what your organization sells or how it is set up: plans, pricing groups, items, item categories, add-ons and credit packages with their versions and publishing (/api/subscriptions/{plans,groups,items,item-categories,offers,credit-packages}), coupons and promotion codes (/api/organizations/payment/stripe/coupons), the Stripe keys (/api/organizations/payment/stripe/credentials), the organization's settings (/api/organizations/settings, PATCH /api/storage/settings), blueprints (/api/blueprint) and environments (a development or staging environment's kit and client secret, its export, and promotion between environments: /api/environments). They take a console session or an admin key: an API key issued as an admin key, with the owner or admin role (see key types).
| Code | Status | When it happens | What to do |
|---|---|---|---|
ADMIN_SCOPE_REQUIRED | 403 | An admin route was called with an app-server key (whatever its role), with a key issued as an admin key whose role is no longer owner or admin, or with your app user's credential (the SDK's sign-in token or its session). Also when a key that is not an admin key tries to issue one | Change the catalog and settings from the console, or with an admin key. Your app's backend keeps an app-server key |
CONSOLE_SESSION_REQUIRED | 403 | A route that moves customers between versions of the catalog (a move's preview, start, confirmation or cancel, or a publish that asks to start or skip one) was called with an API key. Only a person signed in to the console can do these; no key of either type can. Reading a plan's moves takes an admin key too | Preview and confirm the move in the console |
Neither is a 401, so the SDK does not sign your user out. The public reads your app uses stay open to everyone: the plans list (GET /api/v1/public/:orgId/plans/:groupSlug) and promotion codes (GET /api/v1/public/:orgId/promotions/:code).
What changed. Before, these routes were held only by the key's role, so:
- an app-server key (and a key issued before key types existed whose role is not owner or admin) that had been given a role with catalog, coupon, Stripe-key, settings or blueprint permissions could use them; it now gets
403 ADMIN_SCOPE_REQUIREDon every admin route, reads included; - your app user's sign-in token or SDK session got
401on these routes; it now gets403 ADMIN_SCOPE_REQUIRED. On every other console route it still gets401.
A console session, and an owner or admin key issued before key types existed, are unchanged: they read as admin keys, so a blueprint run with your existing key keeps working.
Console sessions and organization access
These are about a person signed in to the BuildBase console, not your app's users: opening an organization (switch-org), the console's own sign-in and its two-step settings, and the console API behind them. A refusal of switch-org is a 200 with success: false and the code.
| Code | Status | When it happens | What to do |
|---|---|---|---|
NO_ACTIVE_PLAN | 200 or 402 | The organization has no active plan or trial: 200 from switch-org, 402 from the console API. The console shows its paywall | Choose a plan for the organization |
SELF_HOSTING_LAPSED | 200 or 402 | A self-hosted organization whose owner's self-hosting plan lapsed past its grace. Carries upgradeTarget: "user" | Renew the person's own plan under My billing in the account menu |
NO_INSTALLATION | 200 or 409 | A self-hosted organization that is not attached to an installation: 200 from switch-org, 409 from completing its setup | Attach it to an installation under Installations in the account menu |
INSTALLATION_OUTDATED | 200 | switch-org into a self-hosted organization whose installation runs a tenant image older than the minimum, or reported no version. Carries minVersion | Pull the newer image, restart, then open the organization again |
TWO_STEP_REQUIRED | 200 | switch-org into an organization that requires two-step sign-in, by someone with no authenticator app | Set up an authenticator app; the console sends the person there |
TWO_STEP_REQUIRED_BY_ORG | 403 | Turning two-step sign-in off while an organization the person belongs to requires it. Carries orgs | Leave that organization, or ask an owner to change the setting |
TWO_STEP_SET_UP_FIRST | 403 | Requiring two-step sign-in for an organization, by someone who has not set it up for their own account | Set it up on your own account first |
TWO_STEP_LOCKED | 429 or 400 | Too many wrong codes on the account: 429 once locked, 400 on the wrong code that locks it | Wait up to 15 minutes and try again |
TWO_STEP_CHALLENGE_EXPIRED | 400 | The sign-in waiting for a code expired, was used up, or ended after too many wrong codes | Sign in again |
SESSION_ENDED | 401 | The console sign-in was ended (from the Security page, or by support), an organization now requires two-step and this sign-in has none, or a refresh is no longer admitted | Sign in again; the console signs out |
SESSION_EXPIRED | 401 | A console token that no longer verifies: expired, or a bad signature. A request with no token, and a permission refusal, stay bare 401s | Sign in again; the console signs out |
READ_ONLY_SESSION | 403 | A write, or a billing session, in a read-only support session (staff impersonation). Not your app's read_only_session under Account and security | Nothing to retry in that session |
AI agent sessions
An AI agent connected to the console acts as the member who connected it. The console API refuses its session with these, all 403, on every request it makes, so a change of setting takes effect at once.
| Code | Status | When it happens | What to do |
|---|---|---|---|
AGENT_READ_ONLY | 403 | A write from an agent whose grant has no console:write scope, or while the organization lets agents only read | Reconnect the agent with console:write, or an owner or admin allows agents to make changes |
AGENTS_OFF | 403 | The organization's AI agents setting is off | An owner or admin turns agents on in the console under Security (card AI agents) |
AGENT_PERSON_ONLY | 403 | A route only a person may call: API keys, sign-in settings, payment and mail provider credentials, organization settings, or a blueprint's environment values | A person does it in the console |
AGENT_BLOCKED | 403 | An owner or admin blocked this member's agent in the organization | An owner or admin removes the block |
Account and security
The calls behind the Profile and Security screens (WorkspaceApi) keep the server's sentence as the message and carry its reason as err.code. Two of them can come from any change the user makes:
| Code | When it happens | What to do |
|---|---|---|
reauth_required | A 403: the change needs a sign-in from the last 10 minutes, and this session is older | isReauthRequired(err), then useSaaSAuth().requireReverification({ factors: err.factors }). See Confirm it's you |
read_only_session | A 403: an app owner is signed in as the user, read-only | isReadOnlySession(err). Show the message; retrying cannot succeed |
impersonation_sign_in_locked | A 403: an app owner is signed in as the user and tried to change how the person signs in (email, phone, username, password, second step, passkeys, linked accounts) | Show the message; it applies to every sign-in-as session, read-only or not |
Neither signs the user out. The rest are listed with their feature: Two-step sign-in, Phone sign-in, Connected Accounts, Usernames, Guest users and Deleting accounts.
Sign-in links
From SDK 1.0.0, two codes come from the SDK itself when a page loads with a sign-in link in its address. onError receives an SDKError with the code; nothing is exchanged and whoever was signed in stays signed in.
| Code | When it happens | What to do |
|---|---|---|
OAUTH_STATE_INVALID | A ?code= whose state is missing, was not issued by this browser's signIn(), or was already used. The code is removed from the address | Start sign-in again with signIn(). A sign-in link someone else sent is the usual cause; a link you build yourself needs the state from signIn() |
IMPERSONATION_TICKET_INVALID | A ?bb_impersonation= ticket from the console's Sign in as user that expired (it lives 60 seconds), was already used or is for another app | Start it again from the console |
Device limit at sign-in
A sign-in call (password, code, magic link, passkey, phone or wallet) can answer 200 with success: false and this code instead of a token, when a device limit is linked to sign-in (claims).
| Code | Status | When it happens | What to do |
|---|---|---|---|
DEVICE_LIMIT_REACHED | 200 | The person is signed in on as many devices as their limit allows, and the limit is set to refuse when full. Carries limitSlug, limit and current | Show the message; they sign out of another device, then sign in |
Enterprise single sign-on
A refused call on bb.enterprise or an enterprise hook (from SDK 1.0.0) throws with the server's code, its HTTP status, and, when one input is at fault, the field to point at. The message is written for the company's admin and can be shown as it is. See Enterprise SSO.
| Code | Status | When it happens | What to do |
|---|---|---|---|
ip_not_allowed | 403 | The request came from outside the company's IP allowlist. The session is kept | Show useAccessRefused()'s sentence; the person works again from an allowed address |
tenant_restricted | 403 | The network's proxy names companies of your app in allowed-company-ids, and this account is not one of theirs: a personal account, or another company's. At sign-in the reason is the same. The session is kept | Show useAccessRefused()'s sentence; the person signs in with their work account, or works again off that network |
tenant_header_invalid | 400 | The network's proxy sent allowed-company-ids twice, and one names a company of your app. The session is kept | Show useAccessRefused()'s sentence: the company's IT team sets its proxy to replace the header, not add a copy |
workspace_access_refused | 403 | A request in one of a company's workspaces that holds its people to stricter rules, and this session does not meet them there. Carries reason (app_team_session, app_not_allowed, ip_not_allowed, sso_required, sign_in_method, max_age or idle), workspaceId, message, reverifiable and methods. The session is kept, and works in the company's other workspaces | useWorkspaceAccess(workspaceId): when reverifiable, confirm() gets back in with one of methods; otherwise signInAgain(), or show the message (stricter rules for one workspace) |
session_ended | 401 | The company's access policy ended the session. Carries reason (enterprise_idle, enterprise_max_age, enterprise_signout or enterprise_session_ended), minutes for a length, and message. The SDK signs out as for any 401 | Show useSessionEnded()'s sentence (when a company ends a session) |
app_team_sessions_refused | 403 | The token exchange named one of a company's people, and the company does not let your team sign in as its people. The message names the company | Ask the company's admins to allow it in their access policy; nothing was minted |
user_blocked | 403 | The token exchange named a blocked user | Unblock the user in the console if that was a mistake |
app_team_self_change | 403 | A change to whether your team may sign in as the company's people, saved from inside a session your team opened as one of them. The company's own admins decide it. A server that asks admins to confirm it's them refuses such a session with reauth_required first | Change it from your console, or ask the company's admins |
reauth_required | 403 | The change needs a proof from the last 10 minutes, one of the ways in methods (sso, passkey): a sign-in that proved one of them, or a confirmation with one of them. A password or ordinary sign-in never counts. Carries maxAgeSeconds, methods and reverifiable. The session is kept, and reason carries the same value This is a company's settings; a person's own change answers the same code with factors instead, see Account and security | isReauthRequired(err): when reverifiable, call requireReverification() and try again; otherwise show the message (confirming it's you) |
reverify_unavailable | 400 | Starting a confirmation from a session nobody signed in to (the token exchange, your team's session as one of a company's people, an agent's), or with methods that leave none of the ways that count for the person | Offer to sign out and sign in again |
invalid_return_url | 400 | A confirmation's returnUrl is not on the origin of one of the auth client's redirect URLs | Return to a page on your app's registered origin |
invalid_request | 400 | Starting a confirmation without a codeChallenge, or with one that is not an S256 challenge (base64url, 43 to 128 characters): "This app's request to confirm it's you is incomplete. Reload the page and try again." | Send the S256 of a code verifier you keep in the browser; requireReverification() does |
invalid_reverify_code | 400 | Completing a confirmation with a code that is unknown, used, expired (after 5 minutes) or another session's, or a verifier that does not match: "That confirmation has expired or was already used. Confirm it's you again." | Confirm again from the same browser |
not_a_person | 404 | Signing out, reading or ending the sessions of, or resetting the passkeys of, someone who is not one of the company's people | Pick someone from the company's people |
last_passkey_required | 409 | Removing the last passkey of someone whose company asks for passkeys: "Your company asks you to sign in with a passkey. Add another before you remove this one." | Show the message; they add another passkey first |
passkey_change_in_progress | 409 | Removing a passkey while another change to the same person's passkeys is being made: "Another change to your passkeys is in progress. Try again in a moment." Nothing was removed | Try again |
sign_in_method_not_offered | 409 | A company's sign-in methods name a way your app's sign-in does not offer | Turn the method on for an auth client, or leave it off the list |
session_not_found | 404 | Ending a session that is not one of that person's live sessions, or has already ended | Read the person's sessions again |
managed_by_app | 403 | Your team keeps the company's security settings, so its admin may read them but not change them | Nothing in the app; the change is yours to make in the console |
would_lock_you_out | 409 | An IP allowlist saved from the app leaves out the address it was saved from (carries yourIp), or, with reason: "sign_in_method", sign-in methods that leave out the way the admin signed in: either the list includes Passkey and they have none ("Add a passkey first, or keep Password on the list."), or the list leaves Passkey out ("Sign in a way it allows first, or keep Password on the list."). From the app, a workspace's rules saved through that workspace that the admin's own session would not meet: reason: "workspace_policy", with the refusal | Offer to add yourIp, as the SDK's screen does; for sign-in methods, add a passkey first, or sign in a way the list allows, or keep their way on the list |
not_enterprise_people | 422 | A break-glass address is not one of the company's people. Carries emails | They sign in through SSO (or are provisioned) first |
invalid_policy | 400 | A session length or allowlist entry out of range | Show the message next to the form |
invalid_workspace_policy | 400 | A workspace's rules out of bounds, or none at all: "Choose at least one rule. To go back to the company's policy, remove these rules." | Fix the value, or remove the workspace's rules |
workspace_policy_not_stricter | 422 | A workspace's rule looser than the company's own. Carries fields: each rule with the company's value, the one asked and the sentence | Choose a value as strict as the company's or stricter |
sso_not_usable | 409 | Requiring single sign-on in a workspace while it does not work for the company | Finish the company's single sign-on setup first |
workspace_policies_full | 409 | Rules for 20 of the company's workspaces already | Remove another workspace's rules first |
workspace_policy_changed | 409 | expectedUpdatedAt is not the workspace rules' updatedAt: someone saved since | Read them again and save again |
workspace_not_bound | 404 | The workspace is not one of the company's bound workspaces; the answer never says whose it is | Choose one of the company's workspaces |
workspace_policy_not_found | 404 | No stricter rules for that workspace | Nothing to read or remove |
binding_has_workspace_policy | 409 | Your console unbinding a workspace with stricter rules without removeWorkspacePolicies: true | Confirm: the binding and its rules go together |
log_stream_limit | 409 | The company already has three log streams | Remove one first |
invalid_log_stream | 400 | One input refused; field names it. Moving a Splunk stream, or an HTTPS stream with a header, asks for the token or header again | Point at field |
nothing_to_renew | 409 | A certificate renewal link while no certificate is expiring or expired | Nothing to renew; the warning has cleared |
not_configured | 409 | A read of something WorkOS holds, such as the company's IT and security contacts, before your WorkOS key is saved. In the app's status it is itContacts.error, and the rest of the status still answers | Save your WorkOS client ID and key on the console's Enterprise tab |
rate_limited | 429 | WorkOS is rate limiting your WorkOS key while the server reads it, for example the IT and security contacts. Comes with Retry-After: 60; in the app's status it is itContacts.error | Try again in a minute |
invitation_active | 409 | Inviting a company's IT admin while WorkOS still holds an open invitation for the company, without Withdraw it and resend, or when WorkOS kept it open whichever contact's invitation was withdrawn (console only) | Choose Withdraw it and resend; if it stays open, the IT admin uses the email they already have |
invalid_days | 400 | Insights for a window other than 7, 30 or 90 days | Ask for one of the three |
invalid_mapping | 422 | A role mapping saved on the console route refused: an unknown role, or the owner role | Pick another role |
not_company_admin | 403 | The company has named its admins and this member holds no company role | Show the message; one of the company's admins makes the change |
company_role_required | 403 | The member's company role does not reach this. Carries area and level | Show the message; someone who manages Company roles gives them a broader one |
unknown_role | 422 | Naming someone with a company role the company does not have | Pick a role from GET /roles |
preset_role | 409 | Changing or deleting Company admin, Security admin or Auditor | Make a role of the company's own instead |
too_many_roles | 422 | A custom company role past the limit of 20 | Delete one first |
too_many_groups | 422 | A company group past the limit of 50 | Delete one first |
group_cycle | 409 | Putting a group inside one it already includes, at any depth. Carries path, the groups outer to inner | Show the message; take the other group out first (groups inside groups) |
group_too_deep | 422 | Putting groups inside groups more than 3 deep, counting both ends. Carries chain | Show the message; include the inner group in a group higher up instead |
group_change_in_progress | 409 | Another change to the company's groups was being saved at the same moment | Try again in a moment |
group_manager_limit | 403 | A group's manager tried what managers may not. reason is company_role (the group gives a company role, itself or through a group that includes it), self or manager (adding or removing themselves, or another of its managers) | Show the message; someone who manages the company's groups makes the change (group managers) |
too_many_managers | 422 | Naming an eleventh manager of a group | Remove one first |
managed_by_idp | 409 | Removing a company admin the identity provider made through a role mapping | Change the mapping or the person's groups |
role_in_use | 409 | Unpublishing or deleting a company role or group, or turning role assignment in WorkOS off, while the company's IT admin still has groups assigned to it in WorkOS. Carries roles, the names WorkOS kept; turning it off names every one | Show the message: the IT admin removes those groups in the Admin Portal (Assign roles in WorkOS), then try again |
workos_roles_off | 409 | Publishing a role or group to WorkOS while your team has role assignment in WorkOS off for the company | Turn on Let the IT admin assign roles in WorkOS for the company in the console |
company_admin_console_only | 403 | Publishing or unpublishing Company admin from the app or the company API | Your team does it from the console |
role_slug_taken | 409 | WorkOS already holds a role under the slug BuildBase would publish. Carries slug, and heldBy when another of the company's own roles or groups holds it | In the console, Use the role WorkOS has; from the app or the company API, ask your team to confirm it there |
too_many_admins | 422 | Naming a company admin past the limit of 20 | Remove one first |
not_connected_apps | 422 | An approved app in the connected apps policy is not a third-party app or agent. Carries clientIds | Approve only agent clients; your own sign-in is never limited |
app_not_allowed | 403 | The person's company does not allow this app or agent, at the consent step | The hosted consent page shows the sentence and a way back |
admins_required | 422 | A personal company API key while the company has named no admins | Name the company admins first, or make the key for a service account |
too_many_keys | 422 | A company API key past the limit of 50 working keys | Revoke one first |
name_taken | 409 | A service account, company role or group with a name the company already uses | Pick another name |
too_many_service_accounts | 422 | A service account past the limit of 20 | Delete one first |
invalid_key | 401 | The company API without a working company API key: none, malformed, unknown or altered | Send Authorization: Bearer bbck_... |
key_revoked | 401 | A company API key revoked by hand, or whose owner holds no company role, or whose service account was deleted | Ask a company admin for a new key |
key_expired | 401 | A company API key past its expiry | Ask a company admin for a new key |
company_unavailable | 403 | A company API key whose company has single sign-on off, or was deactivated or deleted | Nothing to retry |
scope_required | 403 | A company API call the key's scopes, or its owner's company roles, do not cover. Carries scope | Make a key with that scope, or give its owner a role that reaches it |
already_decided | 409 | Approving or declining a request to join that someone already decided | Reload the requests |
outsiders_blocked | 403 | Inviting or adding someone outside the company to one of its workspaces, while its policy blocks people outside it | Show the message; the company's admins decide who is outside it |
outsider_role_limit | 403 | Inviting, adding or changing the role of someone outside the company above its cap. Carries maxRole | Offer maxRole or lower |
outside_company | 403 | Someone outside the company using one of its workspaces while its policy blocks people outside it. The membership is kept | Show the message; the workspace has left their list |
audit_logs_off | 409 | A WorkOS export, the WorkOS log stream, or an audit_logs setup link while your org has company audit logs off | Turn them on in the console's Enterprise tab, or use the CSV and BuildBase's streams |
export_window | 422 | A WorkOS export longer than 31 days, or starting before the last three months or what WorkOS keeps. Carries earliest | Ask from earliest, at most 31 days at a time, or download the CSV |
export_empty | 422 | A WorkOS export of a range WorkOS holds no entries in | Pick another range; WorkOS holds only what was sent since the switch went on |
retention_cannot_shrink | 422 | A WorkOS retention shorter than the one the company's log already has (console only) | Keep it, or raise it: WorkOS does not lower a retention |
sso_routing_invalid | 400 | Which identity provider signs in each domain was not saved. detail says why: unknown_connection, unverified_domain, too_many_for_domain, duplicate_domain, label_invalid, label_taken or default_required, and message says it in words | Show message next to the form |
sso_routing_conflict | 409 | Someone saved the routing since its version was read: "Someone changed this a moment ago. Look again before you save." | Read it again, then save |
use_workos_log_streams | 409 | Adding a BuildBase log stream while company audit logs are on | Set the stream up in WorkOS, from the console; existing streams keep working |
app_team_only | 403 | A setup link for log_streams from the app: WorkOS log streams are billed to your WorkOS account, so your team sets them up | Set it up from the console, or invite the company's IT admin from there |
agent_access_off | 409 | Saving the company's identity provider for agents, or turning it back on, while your team has not turned on enterprise-managed authorization (or the plan lacks agent readiness) | Turn it on under User management > Access > Authentication > Agent readiness; the company's admin asks you |
agent_issuer_invalid | 400 | The company's identity provider was not saved. detail says why: not_https, shared_issuer, discovery_unreachable, issuer_mismatch, no_signing_keys or jwks_unreachable | Show the message beside the issuer field; for issuer_mismatch it names the issuer to paste |
agent_issuer_taken | 409 | Another company in your app already trusts that identity provider (and tenant) for agents. The message never names it | Your team checks which company holds it in the console |
agent_issuer_not_found | 404 | Turning off, changing, checking or removing agents through the identity provider while the company trusts none | Read the company's agent access again |
workload_identity_off | 409 | Saving a workload credential, turning one back on or widening one, while your team has not turned on workload identity for service accounts | Turn it on in the console's WorkOS provider card; the company's admin asks you |
workload_credential_invalid | 400 | The workload credential was not saved. detail says why: not_https, shared_issuer, use_preset, discovery_unreachable, issuer_mismatch, jwks_unreachable, no_signing_keys, matches_everything, pin_required, wildcard_not_allowed, foreign_audience, bad_condition or scope_beyond_you, and claim names the pin where one does | Show the message beside the field claim names |
workload_name_taken | 409 | The service account already has a workload credential by that name | Choose another name |
too_many_workload_credentials | 422 | A service account holds 20 workload credentials, or the company 100; max and per (service_account or company) say which | Delete one first |
agent_session_refused | 403 | Any change to the company's settings (its identity provider for agents, policy, admins, roles, groups, keys, streams, sign-outs, setup links) made inside a session an agent got through the company's identity provider | Nothing to retry as the agent: the person signs in to the app themselves |
Enterprise sign-in and confirmation reasons
These come back from the sign-in calls and the hosted sign-in page rather than from an SDK hook: as reason on a sign-in call your own form makes, and as reason on the redirect back to your login page. The hosted page shows its own fixed sentence for each, never text from the URL.
| Reason | Where | When it happens | What to do |
|---|---|---|---|
sign_in_method_not_allowed | Every sign-in door, after the credential matched | The person's company does not allow this way without single sign-on. Password, magic link and passkey carry allowed, the ways it does allow; sign-up (where anyone can type any address) and social sign-in do not, and a sign-up refusal is not recorded | Show only the ways in allowed, with the message (sign-in methods) |
policy_unavailable | Every sign-in door | The person's company's rules could not be read just now, so the door refuses rather than lets them in: 503 with Retry-After on password, sign-up, magic link and passkey, the reason on the social redirect. "We could not check your company's sign-in rules just now. Try again in a moment." | Show the message; they try again in a moment |
passkey_verification_required | Passkey sign-in | The company asks for passkeys that check the person (fingerprint, face or device PIN), and this one did not | Show the message; the person uses a passkey that does |
passkey_setup_required | A sign-in door, then /redirect | The company asks for a passkey and the person has none, or the person confirms it's them with a passkey and has none: the door answers success with a token that can only set one up, and /redirect refuses that token with this reason (any other kind of token there is a 401) | The hosted page takes them to add a passkey, then signs them in with it |
passkey_sign_in_required | Adding or removing a passkey on the hosted page | Adding: one of a company's people, or someone under a list with Passkey, has a passkey already, and another needs a passkey sign-in from the last 10 minutes; a setup token adds only a first one. "You already have a passkey. Sign in with it, then add another." Removing, for one of a company's people or under a list: the token is not a passkey sign-in that checked them in the last 10 minutes. "Sign in with one of your passkeys first, then remove this one." | They sign in with their passkey, then add or remove one |
wrong_account | Confirming it's you | The person signed in as someone other than the account being confirmed. The session keeps its old time | They sign in with the account they are confirming |
reauth_method_not_allowed | Confirming it's you | They confirmed a way that does not count for them, such as a passkey that did not check them. The message names the ways that do: "Confirm it's you with your passkey." | They confirm the way the message names |
session_ended | Confirming it's you | The session being confirmed ended while they were away. A 401, with the company's own reason when the company ended it, else "Your session has ended. Sign in again." The confirmation is dropped, and the hosted page sends them back to the app's page | They sign in again |
Uploads and storage
An upload through the SDK (useUpload, UploadsApi) rejects with an Error that has err.status and err.code set. uploadFailureOf(err) turns them into a reason you can word yourself - tooLarge, invalid, disabled, userLimit, unavailable or failed - which useUpload also returns as failure. The same codes come back from the console API's asset uploads and from a form's file field, where your own code reads the response body.
| Code | Status | When it happens | What to do |
|---|---|---|---|
UPLOAD_TOO_LARGE | 413 | The file is larger than the route, the form field, the organization's end-user limit or the 1 MB SVG limit takes: when it is declared, while a multipart body is read, or on complete when more arrived than was declared. The body always carries maxBytes, the limit in bytes, and the message states it exactly | Say the limit with maxBytes and ask for a smaller file. On the 5 MB multipart route, upload direct instead |
INVALID_UPLOAD | 400 | The declared size or type is missing or not an image, an end-user upload names an unknown purpose, what arrived is empty or not a supported image, or a multipart upload uses a field the route does not take | Send JPEG, PNG, GIF, WebP or SVG with its real size, and pick the file again |
UPLOADS_DISABLED | 403 | The organization turned end-user uploads off | Hide the upload control: the public settings answer uploads.enabled: false |
USER_UPLOAD_LIMIT | 403 | The file would take this user past the organization's per-user total. The body carries heldBytes and limitBytes | Ask the user to remove an earlier file, or raise the per-user total in the console |
UPLOADS_UNAVAILABLE | 503, 501 | 503: the organization cannot take the file right now (storage full or a plan limit), said neutrally to an end user or a form visitor. 501: the server has no direct uploads configured | Show a "try later" message. As the organization, read the storage meter; on a self-hosted install, set up direct uploads |
UPLOAD_NOT_RECEIVED | 409 | complete was called before the PUT to storage finished | Complete once the PUT answers; retry after a moment |
UPLOAD_FINALIZING | 409 | Another call is completing the same upload right now | Retry after a moment; it answers the same file |
INLINE_FILE_TOO_LARGE | 413 | A JSON body carries a data: file over 16 KB in one field, named in field, while the storage gate is enforced. The body carries maxBytes (16,384), and the message states the limit and the size in bytes | Upload the file and send its URL instead |
PLAN_LIMIT_REACHED | 402 | On the console API, with quotaSlug: "storage-gb": the upload does not fit under the storage ceiling. The body carries storage with usedBytes, reservedBytes, ceilingBytes, wantedBytes and cause (plan, trial or payment). With limitSlug: "max-asset-size-mb" instead: the file is over your plan's per-file limit. The body also carries maxBytes, and the message states the limit and the size in bytes | Delete files you no longer need or move to a plan with more storage; for trial, start the plan; for payment, fix the payment method. See Assets. Over the per-file limit, move to a plan with larger files |
An end user and a form visitor never see PLAN_LIMIT_REACHED: the organization's plan is not theirs to act on, so they get UPLOADS_UNAVAILABLE with 503.
Agent token verification
These are the code values on AppBridgeError, thrown by verifyClientJwt(), verifyAppTokenRequest() and verifyAppRevokeRequest() when a request from BuildBase to your applicationTokenUrl or applicationRevokeUrl fails verification.
| Code | When it happens | What to do |
|---|---|---|
invalid_token | The token or client secret is missing, the JWT is malformed, or a claim has a bad type | Check the Authorization: Bearer header reaches your handler intact |
invalid_algorithm | The JWT header is not HS256 | Reject it; BuildBase only signs with HS256 |
invalid_signature | The signature does not match the client secret | Confirm the client secret in your environment matches the one in the dashboard |
invalid_secret | signClientJwt() was called without a signing secret | Check the environment variable holding the client secret is set where the code runs |
token_expired | exp has passed, beyond the 60-second clock tolerance | Check your server clock; widen clockToleranceSec only if your clock skew is known |
token_not_yet_valid | nbf is still in the future | Same as above: usually clock skew |
invalid_issuer | iss does not equal the issuer option you passed | Fix the expected issuer, or drop the option |
invalid_audience | aud does not contain the audience option you passed | Fix the expected audience, or drop the option |
handleAppTokenRequest() and handleAppRevokeRequest() catch these for you and return a 401 whose body message is the code, so you only handle AppBridgeError directly when you call the verify functions yourself.
OAuth token endpoint: an identity provider's grant
When a company's identity provider approves an agent (agents through a company's identity provider), the agent presents an ID-JAG at your token endpoint with grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer. A refusal is OAuth's shape, { "error": "...", "error_description": "..." } (RFC 6749 section 5.2). The description stays generic for anything about the assertion or the person, and the company's trail keeps the reason; the agent sees these, not your users.
error | Status | When it happens | What to do |
|---|---|---|---|
unsupported_grant_type | 400 | Enterprise-managed authorization is off, or your plan does not include agent readiness | Turn it on under User management > Access > Authentication > Agent readiness |
invalid_client | 401 | No client, an unknown one, a wrong secret, or a metadata-document URL your app could not resolve ("Invalid client") | Check the client ID; for a metadata document, your server's log names the reason |
unauthorized_client | 400 | "This client cannot use the JWT bearer grant.": an app client, or a dynamically registered one | Use a registered agent client, or a metadata-document agent |
invalid_request | 400 | "The assertion is required." or "The assertion is too large." (over 8 KB) | Send the ID-JAG as assertion |
invalid_grant | 400 | "The assertion could not be verified.": its issuer, signature, type, audience, lifetime, the person or the network. Or the company's connected-apps sentence when its policy refuses the agent | Read the company's trail (enterprise_agent_access_refused) for the reason |
invalid_grant | 400 | "The assertion was issued to another client.", "The assertion was already used." or "This assertion asks for something this app does not support yet." | Use the client the assertion names; ask the identity provider for a fresh assertion; drop cnf and authorization_details |
invalid_scope | 400 | "The requested scope is beyond the assertion's." | Ask for the assertion's scopes or fewer |
invalid_target | 400 | "The requested resource is beyond the assertion's." | Ask for the assertion's resource |
temporarily_unavailable | 503 | The single-use check could not be made, or your Application token URL did not mint a token | Retry; if it keeps failing, check your token URL |
Company token endpoint: a workload's exchange
A company's CI job or cloud workload exchanges its own token at POST /api/v1/company/token (workload identity). A refusal is OAuth's shape, { "error": "...", "error_description": "..." }:
error | Status | When it happens | What to do |
|---|---|---|---|
invalid_request | 400 | A field missing or malformed, a token over 16 KB, a reference that does not parse | Send the workload's JWT as subject_token and the credential's reference |
unsupported_grant_type | 400 | Another grant, or workload identity is off ("This app does not exchange workload tokens.") | Use the token-exchange grant; the app's team turns workload identity on |
invalid_grant | 400 | "The token could not be exchanged.": its issuer, signature, type, audience, lifetime or pins | Read the credential's last refusal, or the trail (enterprise_workload_token_refused) |
invalid_grant | 400 | "This token was already exchanged." | Ask the platform for a fresh token |
invalid_scope | 400 | "The credential does not allow that scope." | Ask for the credential's scopes or fewer |
ip_not_allowed | 403 | The credential's addresses, or the company's IP allowlist | Run from an allowed address, or change the credential |
tenant_restricted | 403 | The network's allowed-company-ids header names other companies of your app | Run on a network that allows the company |
temporarily_unavailable | 503 | The single-use check could not be made | Retry |
Refusal reasons in the trail: credential_disabled, company_unavailable, service_account_gone, wrong_type, wrong_issuer, bad_signature, wrong_audience, expired, too_long, conditions_not_met, replayed, ip_not_allowed, tenant_restricted and scope_beyond.
Environments
These are the refusals you can get around a development or staging environment, whether the request came from the console, the CLI or the SDK. Each carries a code beside its status. Branch on the code, never on the wording of the message.
| Code | Status | When it happens | What to do |
|---|---|---|---|
ENVIRONMENT_NOT_FOUND | 404 | The key is not one of the organization's environments, the environment was archived, or environments are not open to the organization. A switch into one answers success: false with this code | Check the key in the Environments card under Settings > General. An archived environment's key never works again |
ENVIRONMENT_NOT_ALLOWED | - | The member has no access to that environment, so the switch into it is refused | An owner or admin gives the member access under Settings > Users |
ENVIRONMENT_INVALID | 400 | A name outside 1 to 40 characters, or a key, name or slug that does not match its shape | Fix the value. A key is exactly eight lowercase letters |
ENVIRONMENT_LIMIT_REACHED | 403 | Adding an environment past the platform's own ceiling on environments per organization, which no plan raises | Archive one you no longer use. Past your plan's own limit, the refusal is 402 PLAN_LIMIT_REACHED with limit and current |
ENVIRONMENTS_DISABLED | 403 | Adding an environment while environments are not open to the organization yet | Nothing to fix on your side; contact support |
ENVIRONMENT_PLAN_UNPUBLISHED | 503 | A request into an environment while the plan environments run on is not available. Production is not affected | Retry later; production keeps working |
ENVIRONMENT_KEY_MODE | 400 | A live Stripe key saved outside production | Use test keys (sk_test_, pk_test_) in an environment. Live keys belong in production |
ENVIRONMENT_UNSUPPORTED | 400 | A custom sign-in domain or a sending domain added outside production | Add it in production. Reads still work in the environment, with nothing in them |
ENVIRONMENT_SECRET_ISSUED | 409 | Asking a second time for the client secret an environment hands out to connect an app. It is handed out once | Copy it from whoever has it, or rotate it (--rotate-secret, or Rotate in the console): the one before stops working |
AGENT_TENANT_MISMATCH | 401 | An agent's token, issued in one environment, used by a request that names another in its x-org-id header: a Staging token at an MCP server set up for production, or the other way round | Connect the agent again from the environment the server is set up for. Tokens issued before this check keep working until they expire |
Promotion between environments (buildbase env push and pull, the console's Changes) answers 403 when the caller is not an owner or admin who may enter both environments, and 404 when the other environment does not exist.
Invitations
Workspace invitations through the SDK (see Invitations) answer these beside the codes listed below.
| Code | Status | When it happens | What to do |
|---|---|---|---|
INVITATION_NOT_FOUND | 404 | No invitation with that id in this organization | Read the invitations again; it may have been revoked |
USER_BLOCKED | 403 | Inviting an account that is blocked, or accepting or declining from a blocked account | Unblock the user in the console if that was a mistake |
INVITATION_EMAIL_FAILED | 502 | The invitation email could not be sent, on a new invitation (nothing was kept) or a resend | Check the organization's email sender, then try again |
Codes documented with their feature
These carry a code too. Each is described in full on the page of the feature that answers it.
| Code | Status | Where |
|---|---|---|
INVITATION_EXPIRED, INVITATION_ALREADY_HANDLED, INVITATION_EMAIL_MISMATCH, INVITATION_RATE_LIMITED, EMAIL_NOT_VERIFIED | varies | Invitations |
WORKSPACE_INVITES_DISABLED | 403 | Invitations |
NOTIFICATION_EVENT_NOT_SET_UP | 403 | Notifications |
SUBSCRIBER_NOT_FOUND | 404 | Subscribers |
CEILING_REACHED | 403 | Users and workspaces |
CLAIM_LINKED, RELEASE_BUDGET_EXHAUSTED | 409 | Users and workspaces |
CLAIM_CAP_REACHED | 429 | Users and workspaces |
SIGN_IN_ADDRESS_MISMATCH | 403 | Your own domain |
SIGN_IN_ADDRESS_UNCHECKED | 503 | Your own domain |
Tracking codes
The code on an sdk_error tracking event is SDK_ERROR when an operation threw an Error, and UNKNOWN_ERROR when it threw something that was not an Error. Use component and action on the same event to find which operation failed.
Common error messages
These have no code; match on the situation rather than the exact string.
| Message | When it happens | What to do |
|---|---|---|
Invalid serverUrl: "...". Must be a valid URL. | Provider config has a serverUrl that does not parse | Include the protocol, e.g. https:// |
Invalid orgId: "...". Must be a valid MongoDB ObjectId (24 hexadecimal characters). | orgId is not a 24-character hex id | Copy the organization id from the dashboard |
Invalid version: "...". Only "v1" is currently supported. | version is not v1 | Pass ApiVersion.V1 |
SDK is not ready (missing serverUrl, version, or orgId) | An API call ran before the config was set | Mount SaaSOSProvider above the component, or pass all three to BuildBase() |
use... must be used within a ...Provider | A hook rendered outside SaaSOSProvider | Move the provider higher in the tree |
Request timeout after 30000ms: GET ... | A request outlived the timeout option (30 seconds by default) | Raise timeout, or set maxRetries for transient failures (retries apply to network errors and 5xx) |
No workspace selected | A credit purchase ran with no current workspace | Wait for useSaaSWorkspaces() to load, or pick a workspace first |
Workspace not found | A delete targeted an id that is not in the user's loaded workspace list | Refresh the workspace list; the user may have been removed |
Only the workspace creator can delete the workspace | A non-owner called delete | Hide the action with usePermissions().isOwner |
Cannot remove the workspace owner / Cannot change the role of the workspace owner | An action targeted the owner | Filter the owner out of member actions |
Messages from the server
When the API responds with an error, the thrown message is the server's own message when it sends one. When it does not, the SDK falls back to <action> (<status>: <reason>), for example Failed to fetch credit balance (403: Forbidden - You do not have permission):
| Status | Fallback reason | Usually means |
|---|---|---|
| 400 | Bad Request | A required field is missing or malformed |
| 401 | Unauthorized - Please check your session | The session expired or was revoked; sign the user in again. With code: "session_ended", the user's company ended it, and the body says why |
| 403 | Forbidden - You do not have permission | The user's role lacks the permission; see Permissions. With code: "reauth_required", the change needs a recent sign-in, and the session is kept |
| 404 | Resource not found | The id is wrong, or the resource belongs to another workspace |
| 500 | Internal server error | Retry; if it persists, contact support |
| 502 | Bad Gateway | The server is unreachable or restarting; retry |
| 503 | Service unavailable | Same as 502 |
Some methods also attach the HTTP status as err.status. It is not set on every call, so check for it before relying on it.
A server failure with no more specific reason answers 503 with the code server_error (lowercase, as sent) and the generic message something went wrong. Treat it as a retry; a 5xx without that code (a coupon's or Stripe's 502, for instance) carries a sentence meant for the person, so show its message.
When the server's cache could not answer a request that needed it (under heavy load, or while it restarts or fails over), the sign-in routes, and any route that has no answer of its own for the failure, answer 503 with code: "temporarily_unavailable", a Retry-After header and the same seconds as retryAfterSeconds in the body. Nothing was wrong with the request: send it again after retryAfterSeconds. Its message says to try again in a moment, and the hosted sign-in page says so in its own language. A sign-in code is used once, so if the retried code exchange is refused, start the sign-in again.
Next steps
- Troubleshooting - symptoms and fixes by area.
- Server SDK - the
BuildBaseclient and its config options.