Skip to content
Logic SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

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. toResponse returns { error: { kind, code, message, details } } for an AppError.
  • oRPC. toORPCProcedure throws an ORPCError with the mapped code, the message, and data with kind, code, and details.
  • AI. toAITool returns the code, message, and details to the model. Invalid input is an invalid tool call, refused before approval, with invalidInput and 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 in bookings.confirm.
  • Reserved names. Error definitions cannot use notFound, forbidden, or invalidInput as 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_error to the model.

See also

Was this page helpful?