Skip to main content
Errors use the error envelope:
Branch on code and the HTTP status. The message is written for people and can change. details is always an object, usually empty; when it carries data, it’s described below.

Standard error codes

These come from the shared API error type and appear across the AgentHub endpoints. MEMBER_NOT_FOUND is defined in the error type but no endpoint currently returns it.

Errors that surface as INTERNAL_ERROR

Some failures that are really your input still come back as 500 INTERNAL_ERROR with the generic message, because the underlying check runs in the database rather than in the API layer. Known cases:

Validation details

VALIDATION_ERROR responses carry details in two shapes. Trace ingestion returns the full list of problems, grouped by top-level field:
Problems inside spans are reported under spans without the span index. Cost Calculator recommendations and evaluation explanations return up to five raw issues with their paths:
All other endpoints put only the first problem in message and leave details empty.

OpenTelemetry endpoint errors

POST /traces (OTLP), POST /metrics and POST /logs use the error envelope only for failures that stop the whole request: Individual spans that can’t be stored don’t fail the request. They’re reported in the OTLP response’s partialSuccess.rejectedSpans with an errorMessage, and the request still returns 200. See OpenTelemetry (OTLP).

Chat and encryption-key endpoint errors

The ModelHub chat endpoints and the encryption-key endpoint use their own codes, in the shape { "error": { "code", "message" } } without details.

Errors inside a stream

Once a streaming response has started (200), failures arrive as an event in the stream rather than as an HTTP error:
  • POST /chat/stream sends data: {"type":"error","message":"..."}. One expected case is a message that contains a credential or government identifier: the server sends a pii event and then an error event, and the client must resend with overridePiiBlock: true to continue.
  • The Cost Calculator .../stream endpoints send {"type":"error","message":"..."} as an NDJSON line.
Authentication and validation failures on streaming endpoints happen before the stream starts and use the normal error responses above.