ibexharness
DocsBlogReleasesRoadmap
GitHub
ibexharness

Documentation

Auth gRPC (ValidateToken, ValidateAgent)Health and metricsChat completions (Phase 1 stub)Errors
API Reference›Errors
API Reference

Errors

Stable JSON error envelope for proxy HTTP responses — codes from packages/apierror per ADR-0013.

Every proxy JSON error uses the same envelope shape. Codes are UPPER_SNAKE_CASE strings from packages/apierror — never ad-hoc literals in handlers. Design record: ADR-0013.

Phase 1 scope

This page covers proxy HTTP errors returned to integrators. Auth gRPC uses standard gRPC status codes; see Auth gRPC. Phase 2+ REST resources are not implemented yet.

Envelope shape

JSON
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request validation failed",
    "detail": "One or more fields failed validation",
    "docs_url": "https://docs.ibexharness.com/errors/VALIDATION_ERROR",
    "request_id": "019abc-def0-7890-abcd-ef1234567890",
    "timestamp": "2026-06-14T12:00:00.000Z",
    "field_errors": [
      {
        "field": "model",
        "code": "REQUIRED",
        "message": "model is required"
      }
    ]
  }
}
FieldAlways presentDescription
codeYesCanonical code from packages/apierror
messageYesSafe, human-readable summary
detailNoAdditional context (no secrets)
docs_urlNoSet when IBEX_ERROR_DOCS_BASE is configured
request_idYesUUID v4/v7 from packages/reqid
timestampYesUTC RFC 3339
field_errorsNoPresent on VALIDATION_ERROR

Field error codes

REQUIRED, TOO_LONG, TOO_MANY, INVALID_ENUM, INVALID_FORMAT

Response headers

All error responses include:

HeaderDescription
X-Request-IDSame value as error.request_id
X-Trace-IDSynthetic trace id until full OTel wiring
X-Response-TimeServer processing time in milliseconds

Configurable via IBEX_REQUEST_ID_HEADER and IBEX_TRACE_ID_HEADER.

Proxy error codes (Phase 1)

Client errors (4xx)

HTTPCodeWhen
400INVALID_JSONMalformed JSON body
400VALIDATION_ERRORSemantic validation failure (+ field_errors)
400MISSING_AGENT_IDX-IBEX-Agent-ID missing on protected routes
401MISSING_TOKENNo Authorization header
401INVALID_TOKENBearer malformed, expired, or revoked
403INSUFFICIENT_PERMISSIONSToken lacks route permission
403AGENT_NOT_AUTHORIZEDAgent unknown or wrong org
403AGENT_SUSPENDEDAgent paused, suspended, or archived
405METHOD_NOT_ALLOWEDWrong HTTP method for route
413PAYLOAD_TOO_LARGEBody exceeds IBEX_MAX_REQUEST_BODY_BYTES (1 MiB)
415UNSUPPORTED_MEDIA_TYPEChat POST without application/json
429RATE_LIMITEDOrg RPM limit exceeded

Server / dependency errors (5xx)

HTTPCodeWhen
501PROVIDER_NOT_CONFIGUREDValid request; no LLM provider wired (Phase 1 stub)
503SERVICE_DEGRADEDAuth ValidateToken failed unexpectedly / deadline
503AUTH_UNAVAILABLEAuth ValidateAgent transport failure
500INTERNAL_ERRORUnhandled server fault

Cross-tenant access

Cross-org resource access returns 403 AGENT_NOT_AUTHORIZED or INSUFFICIENT_PERMISSIONS — never 404 — to prevent enumeration attacks.

Examples

bash
curl -s -X POST http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[]}'
JSON
{
  "error": {
    "code": "MISSING_TOKEN",
    "message": "Authorization header is required",
    "request_id": "…",
    "timestamp": "…"
  }
}

Rate-limited responses include Retry-After and X-RateLimit-* headers with code RATE_LIMITED.

HTTP status mapping

Implemented in packages/apierror.HTTPStatus. Unknown codes default to 500.

1

Handler detects failure

Middleware or handler selects a Code from packages/apierror.

2

errors.Write / WriteFromRequest

Proxy internal layer delegates to apierror.Write with request_id from context.

3

Headers + JSON body

ResponseHeadersMiddleware sets X-Request-ID, X-Trace-ID, X-Response-Time.

Related

  • Chat completions — 501 stub behavior
  • ADR-0013 — limits and middleware order

Was this page helpful?

Edit on GitHub

Last updated on

PreviousChat completions (Phase 1 stub)NextArchitecture Decision Records

On this page

  • Envelope shape
  • Field error codes
  • Response headers
  • Proxy error codes (Phase 1)
  • Client errors (4xx)
  • Server / dependency errors (5xx)
  • Examples
  • HTTP status mapping
  • Related
0%