message for diagnostics. Do not make application logic depend on the exact message text.
Response fields
Error source
Possible values are:
The
router value can describe an error generated by either the router process or Hivenet Router agent code.
The backend value is also intentionally coarse. It does not identify which engine, provider, or machine produced the error.
Response-format scope
The structured envelope is used by known client-facing/v1/* routes, including:
- authentication failures
- model discovery errors
- inference validation errors
- model-access denials
- quota failures
- routing and capacity failures
- classified backend errors
Administration endpoints
Many/admin/* validation responses use the simpler form:
Unknown routes
A request to a route that Hivenet Router has not registered may receive an ordinary HTTP404 rather than a structured Hivenet Router error.
For example:
- structured Hivenet Router errors
- ordinary HTTP errors
- connection failures
- truncated streams
Error-code summary
The status shown is the normal mapping. Some internal failures explicitly return HTTP
500 with backend_error, while forwarded backend or provider failures normally map it to HTTP 502.
Request and authorization errors
request_invalid
- malformed JSON
- empty request body
- missing
model - model ID longer than 256 characters
- an inference engine used with an unsupported capability
- request parsing failure inside a Hivenet Router agent
context_length_exceeded
- system or developer instructions
- conversation history
- tool definitions
- tool results
- multimodal content
- requested maximum output
- prompt size
- retained conversation history
- tool definitions
- retrieved documents
max_tokensmax_completion_tokens
invalid_parameter
temperaturetop_pmax_tokensmax_completion_tokensreasoning_effort- roles or content blocks
- tools or tool choice
- structured-output options
- model-specific parameters
unauthorized
- missing
Authorizationheader - incorrect bearer key
- client sending
x-api-keyinstead - expired static or dynamic key
- disabled dynamic key
- removed key
- using a key hash instead of the raw key
- using an administrator key on a client route
- using a client key on an administrator route
model_forbidden
A model missing from
quota.per_model does not produce model_forbidden.That strict-enumeration case produces rate_limit_exceeded.model_not_found
- correcting the model ID
- registering an agent
- restoring the agent
- changing the key’s access
Request-size rejection
HTTP 413
Hivenet Router limits request bodies under /v1/* to:
HIVENET_ROUTER_MAX_REQUEST_BYTES is rejected before it reaches the normal inference handler. That means the response body is not guaranteed to use Hivenet Router’s structured error envelope or a stable error.code.
Handle this case using the HTTP status:
Quota errors
rate_limit_exceeded
RPM bucket exhausted
Serverless per-key limits
For amode: serverless policy, this code also reports:
per-key occupancy share exceeded, please retryinput token rate exceeded, please retryoutput token rate exceeded, please retry
Retry-After: 1. Occupancy and input-token limits reject the current request. Output tokens are charged after a response finishes, so an exhausted output bucket rejects a subsequent request.
Missing per-model quota declaration
A key usingquota.per_model must enumerate every permitted model.
An undeclared model returns:
token_limit_exceeded
Before routing
The router checks whether this worst case fits:- prompt size
max_tokensmax_completion_tokens
After non-streaming inference
The backend may complete the request before Hivenet Router knows the actual output-token count. When the completion no longer fits:- the response body is discarded
- Hivenet Router returns
429 - the prompt-token deduction remains
- actual usage and the selected agent are preserved in the audit record
Streaming responses
Once a stream has started, Hivenet Router cannot replace the HTTP200 response with a later JSON 429.
Streaming output is accounted for after delivery. When it exceeds the remaining budget, Hivenet Router records the quota event in metrics, but the client retains the already delivered response.
Admission errors
input_too_long
max_input_tokens or images_max cap is exceeded:
concurrency_limit_exceeded
- the request would exceed the model’s token-weighted occupancy budget or
max_inflightlimit and capacity did not become available withinHIVENET_ROUTER_ADMIT_PARK_TIMEOUT; or - aggregate healthy-pool engine pressure breached a configured
shed_ifthreshold before queueing.
Routing and capacity errors
no_agents_available
- agents offline or unhealthy
- unhealthy inference backends
- capability mismatch
- static
matchfilters - dynamic
exclude_ifgates - agents excluded after earlier failed attempts
- a model-specific policy that matches no agents
- all fallback steps exhausted
no_capacity
- wait in the per-model capacity queue
- retry selection after a slot becomes available
- advance through fallback steps
- agent
--capacity - fleet size
- request duration
- engine queues
- context and output lengths
- per-model wait-queue depth
agent_disconnected
- stale peer connection
- unreachable announced address
- firewall or NAT change
- agent restart
- lost network path
- process termination
no_agents_availableno_capacityrequest_timeout
agent_disconnected.
When the code does reach the client, retry with backoff and inspect the agent connection path.
queue_full
queue_full; the final response is normally no_capacity or no_agents_available.
Retry with exponential backoff and investigate:
- request arrival rate
--queue-size--max-concurrent- agent capacity
- backend latency
- router CPU and memory
request_timeout
- waiting for processor concurrency
- waiting in the per-model capacity queue
- policy selection
- retries
- agent redial
- agent forwarding
- inference
- provider fallback
Backend errors
backend_unavailable
- backend connection failure
- model still loading
- backend HTTP
429 - backend HTTP
503 - temporary engine overload
- another agent
- another local fallback step
- an external provider fallback
no_agents_available rather than backend_unavailable.
Retry with backoff when the backend condition is temporary.
backend_error
- inference backend HTTP
500or502 - unexpected backend response
- invalid response JSON
- provider fallback failure
- unstructured error from a transparent proxy endpoint
- storage or authentication-provider failure
- another internal processing error
backend_error directly because no routing step remains after that fallback.
Retry once only when:
- the request is safe to repeat
- the failure appears transient
- retrying will not worsen an overloaded backend
How native Chat Completions errors are classified
The Hivenet Router agent classifies non-success responses from the native:JSON error types
The classifier recognizes both:
A recognized type takes precedence over the HTTP-status fallback.
HTTP and text fallback
When the error type is not recognized:
For this native path, Hivenet Router extracts a message from the backend JSON where possible.
Otherwise, it uses the raw body, truncated to 512 bytes.
A backend HTTP
429 is classified as backend_unavailable, not as Hivenet Router’s rate_limit_exceeded.rate_limit_exceeded describes Hivenet Router client-key quota admission.Errors from transparent proxy endpoints
These paths use the agent’s generic transparent proxy:- It checks whether the body already contains a Hivenet Router structured error.
- If it does, that code and source are preserved.
- Otherwise, the router wraps the body as
backend_error.
400.
Internal routing retries
A backend or agent error is not necessarily returned to the client immediately. Hivenet Router distinguishes several categories.Request-level errors
These stop the routing session immediately:Connection failures
A stale or disconnected agent connection receives one free redial attempt per request. That redial does not consume the policy step’smax_tries budget.
Retryable forwarding failures
Other agent and backend errors can:- mark the selected agent as failed in the current policy step
- select another eligible agent
- continue until
max_triesis reached - advance through the fallback chain
- use provider fallback where configured
Streaming error behavior
A structured JSON error can be returned only before response headers and body have started. After an SSE stream begins:- the HTTP status is already
200 - some output may already have reached the client
- Hivenet Router cannot replace the stream with a JSON error envelope
- a stream ending early
- an incomplete SSE event
- a connection reset
- a client-side parsing error
200.
Use the request ID to inspect the associated audit record, router logs, agent logs, and trace.
Error response headers
Hivenet Router can add the following headers.
Unlimited quota values are omitted rather than represented as negative numbers.
Hivenet Router does not provide a general:
Correlate an error
Every router response includes:- tenant
- dynamic key ID
- model
- status
- error code
- selected agent
- latency
- token counts
- trace ID
Diagnose by status
HTTP 400
Check:
- request JSON
- required model and message fields
- context length
- model-specific parameter support
- tools and structured-output schemas
- backend logs
HTTP 401
Check:
- raw bearer key
- credential expiration
- dynamic key state
- correct client or administrator key type
- reverse-proxy header forwarding
HTTP 403
Check the explicit model allowlist.
HTTP 404
Check:
- endpoint path
- base URL construction
- exact model ID
- client model visibility
- registered agents
404 may mean an unsupported route. A structured model_not_found refers to model discovery or routing.
HTTP 413
Reduce the request body or split a large batch. Check both HIVENET_ROUTER_MAX_REQUEST_BYTES and any reverse-proxy or ingress body limit.
HTTP 429
Inspect:
- RPM exhaustion
- undeclared per-model quota
- insufficient worst-case token budget
- exhausted daily token budget
HTTP 503
Inspect the specific code.
HTTP 504
Check:
- global queueing
- per-model queueing
- policy retries
- connection resets
- backend queue depth
- model loading
- prompt and output size
- router request timeout
Client retry guidance
Before retrying, determine both:- whether the error is temporary
- whether repeating the application operation is safe
Official SDKs and frameworks may add their own automatic retries. Account for those retries when setting:
- request quotas
- application deadlines
- maximum attempts
- concurrency
- audit expectations
Production handling
A production client should:- Parse structured errors when the body matches the Hivenet Router envelope.
- Preserve the HTTP status and
X-Request-ID. - Handle ordinary HTTP errors when no structured envelope exists.
- Distinguish temporary capacity failures from request defects.
- Apply bounded retries with exponential backoff and jitter.
- Avoid retrying unsafe or ambiguous operations automatically.
- Log the code, status, source, request ID, and model.
- Avoid logging credentials or complete sensitive prompts.
- Alert on sustained error rates rather than individual transient failures.
- Use audit records and traces for detailed investigation.
Next steps
Performance characteristics
Understand queueing, concurrency, latency, throughput, and benchmarking behavior.
Use from code
Handle Hivenet Router errors from Python, JavaScript, SDKs, and direct HTTP clients.
Routing concepts
See how retries, fallback steps, capacity, and policy exhaustion affect the final response.
API keys
Configure the request and token quotas behind
429 responses.Admin endpoints
Diagnose fleet health, capacity, routing state, and dynamic key errors.
Audit logging
Correlate error codes with tenants, models, agents, request IDs, and traces.

