Error Handling

Standard error contract, status codes, and resilient handling patterns.

Error Payload Shape

API errors return a stable envelope so clients can parse and branch predictably.

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Retry after 9 seconds.",
    "details": {
      "retryAfter": 9
    }
  }
}

Recommended Behavior

Map errors into retryable and non-retryable classes in your client implementation.

  • - Retry with backoff: 408, 409 (idempotent), 429, 500, 502, 503, 504
  • - Fail fast: 400, 401, 403, 404, 422
  • - Log request IDs for support escalation and traceability

Timeouts and Circuit Breaking

Use explicit client timeouts and open a circuit for repeated upstream failures.

This keeps your upstream dependencies stable when ServoAgent or your own network is degraded.