Skip to content

Error Handling

Directory uses coarse error categories modeled after DNS and HTTP. A sender either gets a route or it doesn’t. The error tells you why at the category level, not the implementation level.

Error Response Structure

{
"status": 404,
"code": "ADDRESS_NOT_FOUND",
"message": "No address found for \"nobody\"",
"field": "address"
}
FieldTypeDescription
statusintegerHTTP status code
codestringMachine-readable error code
messagestringHuman-readable description
fieldstringWhich field caused the error (optional)

Error Codes

CodeStatusMeaning
INVALID_REQUEST400Request is malformed — missing address, bad JSON, wrong content type
ADDRESS_NOT_FOUND404No active address exists for the local part
UNSUPPORTED_PAIR415The DRS does not accept the requested value type / transfer type pair
PATHWAY_NOT_FOUND404Exchange node has no pathway to the requested output pair
INVALID_SIGNATUREClient-side: contract signature failed verification
EXPIRED_CONTRACTClient-side: contract TTL has elapsed
INTERNAL_ERROR500Unexpected server error
KV_UNAVAILABLE503Storage layer is unreachable

Design Rationale

DNS returns NXDOMAIN or an answer. HTTP returns a status code. Directory follows the same pattern. The protocol is a query and a response — it either resolves or it doesn’t. Complex error taxonomies belong in the operator’s implementation, not in the protocol.

Client Behavior

  • 400 — fix the request. Check the field value.
  • 404 — the address or pathway doesn’t exist. Don’t retry.
  • 500 — server error. May retry with backoff.
  • 503 — temporary unavailability. Retry after a delay.