Error envelope
All error responses follow this JSON structure:Field descriptions
Error types
Error type details
400 — invalid_request_error
The request format or parameters are invalid.
Common triggers:
- Missing required field (for example,
name) - Field type mismatch (such as a number where a string is expected)
- Body exceeds the 4 MB limit
- Malformed JSON
401 — authentication_error
Authentication failed.
Common triggers:
- Missing
Authorizationheader - Malformed PAT
- PAT expired or revoked
x-api-keyused instead of a bearer token
403 — permission_error
Authenticated but not authorized.
Common triggers:
- The PAT does not have access to the target Agent (different user or organization)
- The PAT scopes do not cover this operation
- Attempting to operate on an archived and locked resource
404 — not_found_error
The target resource does not exist.
Common triggers:
- Agent, Session, or Environment ID does not exist
- The resource is no longer available
- URL path typo
409 — conflict_error
Resource state conflict prevents the operation.
Common triggers:
- Same idempotency key reused with a different request body
- Operating on a terminated Session
- Creating a duplicate uniquely-named resource
500 — api_error
Internal server error.
Common triggers:
- Service temporarily unavailable
- Internal component failure
- Database connection timeout
For 500 errors, retry with exponential backoff (for example, 1s → 2s → 4s).
Error handling best practices
- Branch on
error.typerather than the HTTP status code. - Log
request_idanderror.messagefor diagnostics. - Inspect
error.paramwhen present to locate the offending field. - Do not retry 4xx errors unless the request was modified.
- Retry 5xx errors with exponential backoff (up to 3 attempts).
Next steps
Overview
How Qoder Cloud Agents fits together.