success: false and an error object containing a machine-readable code, a human-readable message, and the HTTP status code.
Error response format
boolean
Always
false for error responses.object
Error codes
Handling errors in code
With ApiService
ApiService.invoke() throws on error. Wrap calls in try/catch:
With fetch
When usingfetch directly, check the success field in the response body:
With TanStack Query
When using TanStack Query (React Query), errors propagate through the query’serror state:
Retry strategy
Common error scenarios
401 — Missing or expired token
401 — Missing or expired token
The most common cause is an expired access token. Supabase tokens typically expire after 1 hour. Use
supabase.auth.refreshSession() to get a new token.400 — Invalid action for resource
400 — Invalid action for resource
Each resource supports a specific set of actions. Sending an unsupported action (e.g.,
action: "archive" to a resource that does not support it) returns INVALID_ACTION. Check the resource’s documentation in the API reference for supported actions.403 — Insufficient permissions
403 — Insufficient permissions
The user’s role does not allow the requested operation. For example, a
consumer user cannot create genies. See Introduction for the role permission matrix.404 — Resource not found
404 — Resource not found
The record either does not exist or belongs to another user. Non-admin users can only access their own resources. Verify the
id value and confirm the user has access.429 — Rate limit exceeded
429 — Rate limit exceeded
Back off and retry with exponential delay. A simple implementation:

