Error reference
Look up error kinds, codes, default messages, and HTTP statuses.
An AppError carries a kind, code, message, and optional details. Its trail lists calls outermost first and can be empty.
Kinds and statuses
| Kind | What raises it | Default message | HTTP status | oRPC code |
|---|---|---|---|---|
invalid |
Input validation on a top-level call | Invalid input | 400 | BAD_REQUEST |
unauthenticated |
unauthenticated() at the app’s entry or a definition of this kind |
Not signed in | 401 | UNAUTHORIZED |
forbidden |
A policy refusal, ctx.error.deny(), or a definition of this kind |
You can’t do that | 403 | FORBIDDEN |
not_found |
ctx.error.notFound() or a definition of this kind |
Not found | 404 | NOT_FOUND |
conflict |
A definition that reports a conflict with current state | Conflict | 409 | CONFLICT |
rejected |
A definition that refuses a call. This is the default for error(). |
Not possible | 422 | UNPROCESSABLE_CONTENT |
- Fetch.
toResponsereturns{ error: { kind, code, message, details } }for anAppError. - oRPC.
toORPCProcedurethrows anORPCErrorwith the mapped code, the message, anddatawithkind,code, anddetails. - AI.
toAIToolreturns the code, message, and details to the model. Invalid input is an invalid tool call, refused before approval, withinvalidInputand the issues.
Built-in codes
| Code | Source | Details |
|---|---|---|
<function>.invalidInput |
Input validation on a top-level call | { issues: [{ message, path? }] } |
<definition>.forbidden |
A policy refusal or ctx.error.deny() |
None |
<module>.forbidden |
A policy refusal or ctx.error.deny() in an unnamed private function |
None |
<module>.notFound |
ctx.error.notFound() |
None |
unauthenticated |
Default code from unauthenticated(code?, details?) |
Optional app data |
- Definition IDs.
<definition>and<function>include the module key, as inbookings.confirm. - Reserved names. Error definitions cannot use
notFound,forbidden, orinvalidInputas their local ID. - Validation. Invalid nested input, output, event payloads, and error details throw unexpected exceptions.
- Unexpected exceptions. Fetch and oRPC rethrow. AI reports
internal_errorto the model.