Every API error carries a stable code, a human message, agent remediation, and a retryability flag.
Branch on code and retryable. Never on message — messages are written for people and are not part of the contract.

Common codes

A cross-organization ID returns 404, not 403 — confirming existence would be a disclosure.

Deployment failure reasons

A failed deployment carries the deployer’s own reason and remediation, and tiny deploy repeats them before exiting non-zero.
A retryable failure retains its current state for idempotent reconciliation. Retrying with the same operation key resumes rather than duplicating.

Target compatibility refusals

These happen at plan time, before any mutation:

CLI exit codes

Codes 5 and 7 mean “a human has to do something”, not “this failed”. A script should surface them differently from 4 or 9.

Correlating an error

Every response carries X-Request-Id, and the same value appears in error.requestId. Supply your own X-Request-Id to trace a request across the gateway, the control plane, and the deployment log.