Error Reference
How backends/gateway reports errors ā the real envelope and error codes from @nebutra/errors.
Error envelope
The gateway's app.onError handler (backends/gateway/src/app.ts) converts every thrown error
with toApiError() from @nebutra/errors:
{
"error": {
"code": "NOT_FOUND",
"message": "Human-readable description of what went wrong.",
"details": { "suggestion": "..." }
},
"requestId": "req_..."
}requestId is only present when the caller sent an x-request-id header. details is only
present when the underlying AppError carried metadata or a suggestion. There is no success
field ā a 2xx status means success, a non-2xx status with this envelope means failure.
A 404 with no matching route (rather than a thrown NOT_FOUND error) returns a simpler shape from
Hono's notFound handler: { "error": "Not Found", "path": "..." }.
Error codes
From ERROR_CODES in @nebutra/errors (packages/platform/errors/src/index.ts):
4xx ā Client errors
| Code | Typical status |
|---|---|
BAD_REQUEST | 400 |
VALIDATION_ERROR | 400/422 (per throw site) |
UNAUTHORIZED | 401 |
FORBIDDEN | 403 |
NOT_FOUND | 404 |
CONFLICT | 409 |
RATE_LIMITED | 429 |
QUOTA_EXCEEDED | 429 |
5xx ā Server errors
| Code | Typical status |
|---|---|
INTERNAL_ERROR | 500 |
DATABASE_ERROR | 500 |
SERVICE_UNAVAILABLE | 503 |
EXTERNAL_SERVICE_ERROR | 502 |
TIMEOUT | 504 |
Business errors
| Code | Meaning |
|---|---|
PAYMENT_REQUIRED | Billing action needed before the request can proceed |
SUBSCRIPTION_EXPIRED | The tenant's subscription lapsed |
FEATURE_DISABLED | The plan doesn't include this entitlement (see checkEntitlement in @nebutra/billing) |
TENANT_SUSPENDED | The tenant is suspended |
Every thrown error's actual HTTP status comes from getStatusCode(error), which reads the
AppError's own statusCode ā the table above is typical, not guaranteed, for a given code.
Support
Open an issue on GitHub with the requestId
and the request path/method. There is no separate Nebutra support desk for a self-hosted template
ā you own the deployed service.
How is this guide?
Last updated on