All docs

Error codes

Error codes

Stable identifiers callers depend on. The string is the contract — never rename a code, only deprecate + add a new one.

Source of truth: packages/shared/src/errors.ts. CI lint will fail if a code in this file is missing from the union (and vice-versa).

Conventions

  • Code is <domain>.<reason> (snake_case after the dot).
  • details carries extra structured fields the client may render (e.g.

{ used, limit, reset_at } on quota.exceeded, { retry_after_ms } on rate limits). Never put a stack trace there.

  • Server logs the full err.stack; the wire response goes through

DomainError.toJSON() which strips stack/cause.

  • MCP JSON-RPC codes:

- -32602 validation (per JSON-RPC spec) - -32001 auth/authz - -32004 not found - -32005 conflict - -32006 quota / payment - -32007 rate limit - -32000 everything else (implementation-defined range)