Skip to Content
v1.27.0 · shipped Global XHR capture, Hash-router inventory Read the changelog →
ConceptsAPI error catalog

API error catalog

Every Mushi API failure uses the same envelope:

{ "ok": false, "error": { "code": "VALIDATION_ERROR", "message": "Human-safe explanation", "requestId": "a1b2c3d4e5f6" } }

Why codes exist

  • code is stable and greppable — quote it in bug reports.
  • message is safe for end users (no Postgres text, no stacks, no secrets).
  • requestId (also on the X-Request-Id response header) links the console error, Sentry event, edge access log, and — for LLM routes — the Langfuse trace.

The closed set of codes lives in error-codes.ts and is published as the OpenAPI Error.code enum. The generated table is docs/ERROR_CATALOG.generated.md.

Codes you will see often

CodeWhat it usually meansWhat to do
MISSING_AUTHNo Bearer token / API keySign in again or mint a key
INVALID_TOKENExpired or revoked JWTRefresh the session
NO_ORG / NO_ORGANIZATIONConsole call without X-Mushi-Org-IdPick a team in the org switcher
NO_PROJECT / PROJECT_NOT_FOUNDMissing or inaccessible projectSwitch project or reconnect
VALIDATION_ERRORBody / field failed Zod or validatorsFix the highlighted fields
RATE_LIMITEDToo many requestsWait and retry
QUOTA_EXCEEDED / FEATURE_NOT_IN_PLANPlan gateUpgrade or lower usage
DB_ERROR / RPC_ERRORPersistence failure (detail in Sentry only)Retry; if persistent, quote code + requestId
INTERNALUnhandled server exceptionQuote requestId — it was captured

Console feedback

Admin pages that load through usePageData render failures with <PageLoadError><ErrorAlert>, which shows:

  1. A plain-English title + hint (humanizeApiError)
  2. A recovery action when one exists (create team, switch project, …)
  3. A monospace caption: code · endpoint · request

SDK reporters

The web and React Native widgets distinguish:

  • queued offline / retrying
  • rate limited (429)
  • quota blocked (403 / QUOTA_EXCEEDED)
  • permanent credential failures (401 / 403)

so reporters never see a fake “success” checkmark for a dropped report.

Drift gate

pnpm check:error-codes (part of pnpm check:drift) fails when the registry, OpenAPI Error.code enum, or this page drift apart.

Last updated on