Skip to main content

Error response shape

Every error response uses the same JSON envelope:
string
required
Machine-readable error code in SCREAMING_SNAKE_CASE. Use this field in switch statements and retry logic — never parse the message string programmatically.
string
required
Human-readable description for logging and debugging. This string may change between API versions — do not rely on its exact content.
object
Additional error-specific fields. May be an empty object {}. See the table below for codes that include structured details.

Error codes reference

TURN_ERROR and SERVICE_UNAVAILABLE are not HTTP status codes — they only appear as the code field of a WebSocket error frame during a text turn. See Handling WebSocket errors below.

Codes with structured details

CREDENTIAL_BLOCKED — 403

FraudGuard blocked this credential due to suspicious activity. The details object includes a blocked_until timestamp indicating when the block automatically expires.
Do not retry until after blocked_until. If the block appears incorrectly applied, contact support@humain.ai with the credential label.

INPUT_REJECTED — 400

The user’s input was blocked before reaching the LLM. Check details.reason to understand why.
Do not surface reason directly to end users — it may expose internal rule configuration.

RATE_LIMITED — 429

The device has exceeded its allowed request rate. Back off for details.retry_after_seconds before retrying.

VALIDATION_ERROR — 422

The request body did not match the expected schema. details is a map of field names to error messages.

Handling HTTP errors (session open/end)

POST /v1/sessions and POST {agent_url}/v1/sessions/{sid}/end use the standard error envelope above. Text conversation turns run over a WebSocket, not HTTP — see WebSocket streaming for how errors surface there instead (a {"type":"error",...} frame on the same connection, not an HTTP status code).

Handling WebSocket errors (conversation turns)

Errors during a turn arrive as a JSON frame on the open connection with code: "TURN_ERROR" — the real machine-readable reason is the SCREAMING_SNAKE_CASE prefix of message, before the first : .