Error reference
The API is OpenAI-compatible, but validation and plan enforcement add ValGuard-specific statuses and `error.type` values. Use this page to map failures to fixes quickly. A blocking validator returns 403 with validation_block unless the agent sets another validation_fail_status.
- Public routes return JSON with
error.code(for exampleinvalid_api_key,not_found,missing_model,invalid_temperature,provider_rejected_key). - Playbooks:
flow_not_foundwhen the slug is unknown;playbook_not_publishedwhen a draft exists but is not published. - Oversize request headers: nginx rejects the request before the Go proxy (internal 494). The API responds with JSON
400bad_requestand dashedX-Request-Id/X-Vg-Request-Idwhen the request-id map is loaded. - Request body over 1 MiB returns 413
request_too_large. - A transcript over 262,144 bytes returns 413
transcript_too_large. max_tokensis capped at 8192.- Request header size limits (nginx, before Go):
large_client_header_buffers 4 32k(HTTP/1.1 large header lines and the HTTP/2 header block on current nginx). Above the effective limit you get JSON400 bad_requestwith dashedX-Request-Id/X-Vg-Request-Idfrom the nginx map. Valid requests that reach the Go proxy mints a v4 id unless the client sent a valid RFC 4122 UUID (any version), which is adopted on both headers. - Input-phase results are on
X-VG-Input-StatusandX-VG-Input-Warnings, including shadow hits.
Validation response headers
- X-VG-Validation-Status: pass | warn | block | shadow | stream_passthrough | fail
- X-VG-Healed, X-VG-Healed-Rules, X-VG-Healed-Event-Count, X-VG-Healed-Trace
- X-VG-Repair-Attempted, X-VG-Repair-Rules (set when repair ran but validation still blocked)
- X-Vg-Upstream-Retries: count of automatic upstream chat attempts after the first call (502/503/504 recovery, empty tool calls, finish_reason=length format retry, and similar). Omitted on early rejects before upstream; 0 when no retries ran.
- X-Vg-Max-Tokens-Adjusted: client max_tokens raised for a length retry (for example 48->256)
- X-VG-Span-Id: 16 lowercase hex span id for this API hop (random; not present on nginx-only 400s)
- X-VG-Request-Id: canonical trace id for dashboards and logs
- X-Request-Id: always matches
X-VG-Request-Idon proxy responses. A valid RFC 4122 client UUID (v1–v5, standard variant) is adopted. Nil and all-f UUIDs are rejected and replaced with a fresh v4 id. Non-UUID client trace strings are stored for logging only (not echoed on either header). nginx JSON edge errors (400/494/5xx) use the dashed request-id map; sendX-Request-Idbefore headers that nginx may reject (for example duplicateAuthorization) if you need that id echoed on the 400. - X-Vg-Build: git commit stamped at proxy build time (also on GET /healthz JSON)
A successful re-ask is stored on the request as reasked_ok. The response header for that call is pass. X-VG-Healed is set only when the final response passed because of repair. A repair that still blocks is X-VG-Repair-Attempted and does not set X-VG-Healed. Repair presets are agent settings, not request headers.
| HTTP | error.type | Meaning | Recommended action |
|---|---|---|---|
| 400 | bad_request | Request body or model payload is malformed. | Validate JSON shape and required fields before retrying. |
| 401 | unauthorized | API key is missing, revoked, or invalid. | Use a valid `Authorization: Bearer vg_live_...` key from dashboard API keys. |
| 403 | validation_block | A blocking validator rule failed for this response. | Inspect `details` and tune agent rules, prompt, or payload format. |
| 409 | conflict | Plan or quota operation conflict (for example API key limits). | Review plan limits in billing/settings and retry after adjusting configuration. |
| 422 | validation_error | Optional. Agents can set validation_fail_status to 422. The default validation block is HTTP 403 validation_block. | Treat 403 as the default block. Use 422 only when that agent is configured for it. |
| 429 | rate_limited | Too many failed API key authentication attempts from this client IP, or organization throughput limits were exceeded. | Honor Retry-After, fix the key, and avoid retrying invalid credentials in a loop. |
| 400 | duplicate_header | Duplicate or conflicting headers (for example two X-VG-Idempotency-Key values, or Authorization plus a different X-VG-Api-Key). | Send each identity header at most once; use either Authorization or X-VG-Api-Key, not both with different keys. |
| 400 | orchestration_stream_unsupported | Playbook execution (X-VG-Flow) does not support stream: true. | Call playbooks without streaming; use single-agent chat for SSE. |
| 429 | monthly_cap_exceeded | Monthly request allowance has been reached (1 request = 1 complete flow checked against your active rules). | Upgrade your plan, or on a paid subscription enable overage billing in Billing before sending more traffic. Free plans are hard-capped. |
| 402 | token_cap_exceeded | A configured org or per-agent monthly token cap has been exceeded. | Raise org or agent token caps in Billing/Agent settings, or enable token overage on a paid subscription when an org cap is set. Returns 402 (not 429). |
| 500 | orchestration_failed | Playbook graph execution failed without a more specific upstream or validation code. | Inspect X-VG-Run-Id and step trace headers; fix routing, agents, or provider keys and retry. |
| 500 | internal_error | Unexpected server-side issue in the validation layer or upstream path. | Retry with request id and check status page/logs for ongoing incidents. |