Reference · 04 · failure modes
When a delivery does not land.
Every failure is classified before it is retried, and every class maps to exactly one operator action. This page is the complete failure contract for API v1 — if a behaviour is not described here, it is a bug and we want the x-request-id.
01Error envelope
Control-plane failures always return a JSON object with a single error key. The code field is stable and safe to branch on; message is for humans and may change between releases. retry_after_ms is present only when the request is retryable.
{
"error": {
"code": "rate_limited",
"message": "Source src_01J9K3M8YVQ2 exceeded 3000 events per minute.",
"status": 429,
"retry_after_ms": 12000,
"request_id": "req_01JCA1M4R2D8K7N3Q5V0W6X9YZ",
"details": [
{ "field": "source", "issue": "quota_exceeded", "limit": 3000, "window_s": 60 }
]
}
}
The same envelope is used by the sandbox. Validation failures add one details entry per offending field; no more than twenty are returned per response.
02The code table
Eighteen codes cover the entire API. “Retry” refers to the client's behaviour toward Gateway, not Gateway's behaviour toward a consumer — that is a separate table below.
| Status | Code | Meaning | Retry | Resolution |
|---|---|---|---|---|
| 400 | invalid_request | Malformed JSON, wrong content type or a body that is not an object. | No | Fix the serialiser; check for a BOM or a double-encoded body. |
| 401 | unauthorized | Missing, expired or revoked bearer token. | No | Issue a token for the correct environment; check for whitespace in the header. |
| 401 | signature_mismatch | The source signature does not match the raw body, or its timestamp is outside 300 s. | No | Sign the exact bytes you send; recompute on every retry attempt. |
| 403 | insufficient_scope | The token is valid but lacks the scope the method requires. | No | Request the scope in the console; replays need deliveries:write. |
| 403 | source_mismatch | X-Gitiox-Source is not bound to this token. |
No | Use the token issued for that source, or issue a new one. |
| 404 | not_found | No delivery or endpoint with that identifier in this region. | No | Check the prefix and the region; ids are not portable across regions. |
| 409 | idempotency_reuse | The Idempotency-Key was used before with a different body. |
No | Generate a new key per logical operation, not per attempt. |
| 409 | not_replayable | The delivery is queued or delivering, or its endpoint is inactive. | After 60 s | Wait for the current attempt to settle; reactivate the endpoint first. |
| 410 | delivery_purged | The seven-day retention window has closed; the envelope is gone. | No | Re-publish from the source, or restore from your own archive. |
| 413 | payload_too_large | Body exceeds 1 MiB after decompression. | No | Send a reference and fetch the blob separately; the envelope is not a file transfer. |
| 415 | unsupported_media_type | Content-Type is not application/json. |
No | Set the header explicitly; do not rely on a default. |
| 422 | validation_failed | The body parses but a field violates the schema. | No | Read error.details[].field; one entry per invalid field. |
| 422 | invalid_cursor | The pagination cursor is expired or from another filter set. | No | Restart the listing without starting_after. |
| 429 | rate_limited | A rate-limit class is exhausted for the current 60-second window. | Yes | Honour Retry-After; never spin without backoff. |
| 500 | internal_error | An unhandled fault in the control plane. | Yes | Retry with jitter, then escalate with the request id. |
| 502 | upstream_error | The serving region cannot reach its storage or signing service. | Yes | Back off; check status.gitiox.com before paging. |
| 503 | service_unavailable | The region is draining for a deploy, or the queue is saturated. | Yes | Honour Retry-After; deploys drain within 90 s. |
| 504 | upstream_timeout | Storage acknowledgement did not arrive within the 5-second control-plane budget. | Yes | Retry the identical request with the same Idempotency-Key. |
Table 1 — API error codes. Codes are additive within v1; none will change meaning before v2.
Not retryable
A retry will not fix invalid_request, signature_mismatch, validation_failed or payload_too_large. Retrying them counts against your control-plane quota and delays the operator who can actually fix the payload.
03Delivery attempt outcomes
Separate from API errors: what Gateway does when your endpoint answers. The classification is fixed and applies to every attempt.
| Consumer response | Outcome | Retried | Notes |
|---|---|---|---|
| 2xx | delivered | — | Body is ignored. Return an empty 200 or 204 as fast as possible. |
| 3xx | failed | No | Redirects are not followed. Point the endpoint at the final URL. |
| 400 · 401 · 403 · 404 · 405 · 410 | failed | No | The consumer rejected this envelope. Fix and replay. |
| 408 · 425 · 429 | retryable | Yes | Retry-After from the consumer is honoured up to 60 minutes. |
| 5xx | retryable | Yes | All 5xx, including 501. Return 5xx only when you want a retry. |
| Timeout | retryable | Yes | 2 s connect, 10 s total. A 2xx after 10 s counts as a timeout. |
| Connection error | retryable | Yes | DNS, reset, refused, TLS handshake failure. Certificate errors are retried until the budget ends. |
Table 2 — delivery attempt classification. Only 2xx is success; everything else ends in retry or failure.
04Retry schedule
Backoff is exponential, measured from the end of the previous attempt. Each delay is jittered by ±20% to avoid synchronised retries across a fleet, and a delivery can be delayed up to 30 seconds by scheduling. The whole budget fits inside a six-hour window.
- 010 s
- 02+ 30 s
- 03+ 2 m
- 04+ 10 m
- 05+ 30 m
- 06+ 1 h
- 07+ 1 h 30 m
- 08+ 2 h
Total nominal budget 5 h 12 m 30 s; with jitter and scheduling the last attempt lands within 6 h 15 m of the first. Attempt 9 does not exist — the envelope moves to the dead-letter queue.
| Attempt | Delay | Cumulative | State between attempts |
|---|---|---|---|
| 1 | — | 0 s | delivering |
| 2 | 30 s | 30 s | failed, retry scheduled |
| 3 | 2 min | 2 m 30 s | failed, retry scheduled |
| 4 | 10 min | 12 m 30 s | failed, retry scheduled |
| 5 | 30 min | 42 m 30 s | failed, retry scheduled |
| 6 | 1 h | 1 h 42 m 30 s | failed, retry scheduled |
| 7 | 1 h 30 m | 3 h 12 m 30 s | failed, retry scheduled |
| 8 | 2 h | 5 h 12 m 30 s | failed, retry scheduled |
| — | — | ≈ 6 h | dead_letter |
Table 3 — nominal schedule. retry_after_ms on a dead-letter delivery is always null.
Two rules override the schedule. A consumer's Retry-After header is honoured for values up to 60 minutes — the attempt is not skipped, only delayed. Deactivating the endpoint pauses attempts without consuming budget; reactivating resumes at the next scheduled attempt.
05Timeouts and idempotency
A retry is the same envelope delivered again with a fresh signature timestamp, so consumers must deduplicate on X-Gitiox-Delivery. Two attempts racing after a slow response are possible and expected.
| Phase | Budget | On expiry |
|---|---|---|
| DNS + TCP connect | 2 s | Attempt fails as connect_timeout, retried. |
| TLS handshake | 3 s | Attempt fails as tls_error, retried. |
| Response start | 10 s total | Attempt fails as response_timeout, retried. |
| Response body | 4 KiB captured | Body truncated, attempt outcome unchanged. |
| Signature tolerance | 300 s | Retry recomputes the signature; consumers must not cache the header. |
Table 4 — delivery timeouts. A 200 that arrives after the total budget is a timeout, not a success.
Idempotency on the consumer
Store the delivery id before doing side effects. Gateway will redeliver after a timeout even if your handler completed the work and the response was lost in transit. A consumer that is not idempotent will duplicate work on the first slow response, not the eighth retry.
06Dead letters and replay
After the eighth failed attempt the envelope moves to dead_letter. It is retained for seven days and can be replayed once the consumer is fixed; the dead letter itself is not deleted by a replay, only marked.
- Retention. Seven days from the last attempt. The field
purge_aton the delivery gives the exact instant. - Replay count. Unlimited within the retention window, subject to 60 replays per minute per token.
- Attempt counter. A replay starts at attempt 1 with the delivery budget you specify (default 8).
- Audit. Every replay is recorded with the reason string, the token id and the caller's request id.
- Purge. After
purge_atthe envelope bytes are removed; the delivery row keeps the status and the attempt count for 30 days.
List the backlog before a drain with GET /v1/deliveries?status=dead_letter&endpoint_id=…, as shown in the reference.
07429 and backoff on the client
A 429 is a normal response, not an incident. The window is a fixed 60 seconds; Retry-After gives the remaining seconds. Clients that retry in a tight loop make the quota problem worse for every other producer on the source.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 12
x-ratelimit-limit: 600
x-ratelimit-remaining: 0
x-ratelimit-reset: 12
x-request-id: req_01JCA1M4R2D8K7N3Q5V0W6X9YZ
{ "error": { "code": "rate_limited", "message": "Control-plane quota exhausted.", "retry_after_ms": 12000 } }
URL="https://gateway.gitiox.com/v1/deliveries?limit=100"
retry_after=$(curl -sS -D - -o /dev/null "$URL" \
-H "Authorization: Bearer $GITIOX_TOKEN" \
| awk 'BEGIN{IGNORECASE=1} /^retry-after:/{gsub("\r","",$2); print $2+0}')
sleep "${retry_after:-5}" # 429 carries the exact remaining window
For ingest, spread producers over time rather than retrying a burst: a single source has one quota, shared by every producer identity. If a producer legitimately needs more than 3,000 events per minute, request a quota increase through support; increases above 10,000 per minute require a capacity review.
08What to attach to a ticket
Support can join a request to an attempt only with all five identifiers. The console copies this block from the delivery detail screen in one click.
| Item | Where to find it | Example |
|---|---|---|
| Delivery id | Delivery detail, or dlv_ in the ingest response | dlv_01JCA1M4Q7T3XK9Z2P8R5V6WNE |
| API request id | x-request-id on the failing response | req_01JCA1M4R2D8K7N3Q5V0W6X9YZ |
| Consumer request id | Attempt log, per attempt | req_consumer_88f2a1 |
| Endpoint id | Endpoint list, or endpoint.id on the delivery | ep_01JC9Z4T7M2XQP6VF3K8N1RAWD |
| UTC timestamp | The at field of the failing attempt | 2026-11-21T18:03:41Z |
Table 5 — the five identifiers required for delivery forensics.
Escalate now
Page the on-call engineer through security@gitiox.com if you see signature_mismatch on deliveries you can reproduce with the stored secret, or any delivery claiming a source you do not own. Do not replay the delivery first — preserve the attempt log.