reference

Error codes

The error codes the runtime emits, when they happen, and which ones you can recover from.

When the runtime returns an error, the response body carries a code field with one of these values. The codes describe what went wrong. The HTTP status is usually yours to choose with fail and raise, though the runtime sets it on its own in some cases. For example schema validation returns 422, a unique-index violation returns 409 with the unique_violation code, and a failed require auth or allow returns 401 or 403.

Load-time

This code happens when the project is loaded (serve, test, doctor) and stops the server from starting. Fix it before the app can run. marreta doctor reports it.

CodeMeaning
config_errorA route or export conflict, a schema cycle, an incompatible runtime, or an invalid persistent schema.

Runtime: your code

These point to a bug in the project and surface as a 500 unless you handle them.

CodeMeaning
reference_errorAn undefined variable or task, a missing property, or a value that is not callable.
type_errorA value had the wrong type for the operation.
arity_errorA task was called with the wrong number of arguments.
arithmetic_errorDivision by zero or another arithmetic fault.
raise_errorAn explicit raise from project code.

Runtime: infrastructure

These come from a provider or a fallible operation. They are the ones you can recover from with rescue (see Handle errors).

CodeMeaning
db_errorA relational database operation failed.
cache_errorA cache operation failed.
queue_errorA message queue operation failed.
http_client_errorAn outbound http_client request failed.
io_errorA filesystem or project-load I/O failure.
infrastructure_errorAn infrastructure dependency was unavailable.
unique_violationA write violated a unique index or constraint. Returned as HTTP 409. Fires for both the relational and the document provider, including an index you created by hand.
runtime_errorA generic runtime fault not covered by a more specific code.

Validation

A route that binds a body with take payload as Schema validates it against the schema before your code runs. When the body does not match, the runtime returns HTTP 422 with a message naming the offending field, and your route body never executes. You do not write this check, and you do not choose its status.