Skip to main content
The Fieldnode API returns failures as JSON with a stable shape across every endpoint. The HTTP status is set from the error code.

Error JSON format

Typical error response:
When a procedure declares typed error data, the payload is included under data:

Fields

  • code — Machine-readable error code in SCREAMING_SNAKE_CASE (see table below).
  • status — HTTP status code, also reflected on the response itself.
  • message — Human-readable description of the failure.
  • definedtrue when the error was declared on the procedure contract (so data is typed); false for generic/uncaught errors.
  • data — Optional, procedure-specific payload. Only present for defined: true errors that declare a data schema.

HTTP status and error code mapping

Notes

  • Use code for programmatic behavior (retry, prompt login, user messaging); the HTTP status mirrors it.
  • Treat message as informational — do not parse it for control flow.
  • Only inspect data when defined is true; for undeclared failures the field is absent.
  • Input validation failures (Zod) surface as BAD_REQUEST with details about the offending fields in data.
  • 499 (CLIENT_CLOSED_REQUEST) is not part of the standard HTTP status registry but is the conventional code for client-aborted requests.