This hidden page records the retry behavior visible in the Ledger 3.0 source snapshot. It is preparatory guidance, not a complete published error contract. The safe principle already applies: a timeout can occur after Ledger commits a write, so repeating an unprotected request can create another financial operation.
Error body#
Every error response carries the same two required fields:
Branch on errorCode, not on the status alone. One status covers several conditions with different correct responses: a 409 can be an idempotency conflict or an ordinary state conflict, and a 400 can be a validation failure or an insufficient-funds outcome. The status tells a client which class of handling applies; errorCode tells it what to do.
A bulk request is the one exception to the shape. A failure of the bulk request itself uses the standard body, while a per-element failure appears inside that element's result as errorCode and errorDescription.
HTTP error classes#
| Status | Meaning | Client action |
|---|---|---|
400 | The request or business input is invalid | Correct the request; do not retry unchanged |
401 | The token is missing, invalid, or expired | Obtain a valid token |
403 | The caller lacks the required scope | Change authorization, not the request body |
404 | The requested ledger or resource does not exist | Verify the identifier and environment |
405 | The route exists but does not accept this method, always as METHOD_NOT_ALLOWED | Correct the method; do not retry unchanged |
409 | The request conflicts with existing state | Inspect the conflict before choosing a new identifier |
413 | The request body exceeds 4 MB, as BODY_TOO_LARGE, or a bulk request exceeds 1000 elements, as BULK_SIZE_EXCEEDED | Split the payload; retrying the same request cannot succeed |
429 | A resource is exhausted. Disk protection also lands here: WRITES_BLOCKED_DISK_FULL means writes stay blocked until an operator reclaims storage | No Retry-After is sent. Apply bounded backoff with jitter, and check errorCode before retrying a write |
503 | The cluster cannot currently serve the operation: commonly no leader, but also a read store still catching up, an index still building, or the clock-skew write gate | Every 503 carries Retry-After: 1. Honor it, then apply bounded backoff if the condition persists |
500 | Ledger encountered an internal failure | Record the correlation ID when the response includes one, then involve the operator |
These are the classes a client meets on the business routes, not a closed set. The snapshot has no single authoritative enumeration of statuses per operation, so handle an unlisted status by its class and branch on errorCode within a class.
The preview OpenAPI file attempts to define operation-specific responses, while the HTTP API design describes common error handling. The OpenAPI file is not a definitive contract yet: a duplicate response key prevents strict parsing, and its declared version is inconsistent with Ledger 3.0.
Protect write retries#
Send an idempotency key with every write that may be retried. In Ledger 3.0:
- the key namespace is cluster-wide, not scoped to one ledger;
- a key is limited to 256 bytes, not 256 characters, so a key using multibyte UTF-8 is rejected below 256 characters;
- the same key and request content resolve to the original operation while the key remains valid;
- the same key with different content returns a conflict;
- successful results and definitive business failures are retained, while authentication and infrastructure failures are not replay records;
- the default retention is 24 hours, but operators can configure it.
Build keys from a stable application operation identifier. Include enough context to prevent two ledgers or workflows from choosing the same value.
Do not assume an idempotency key remains available beyond the configured retention period. If the business operation requires permanent uniqueness, also use a stable transaction reference or enforce uniqueness in the calling system.
Retry decision#
| Situation | errorCode to match | Retry? |
|---|---|---|
| Connection failed before a read | No response arrived | Yes, with a deadline and bounded backoff |
Read returned 503 | Any | Yes; honor Retry-After: 1, then bounded exponential backoff with jitter |
Read returned 429 | Any except WRITES_BLOCKED_DISK_FULL | Yes, with bounded exponential backoff and jitter; no header is sent |
| Writes blocked by disk protection | WRITES_BLOCKED_DISK_FULL | No; backoff cannot clear it, an operator must expand or reclaim storage |
| Protected write timed out or returned a retryable status | Any | Yes, with the same idempotency key and identical body, bounded by the operation deadline |
| Unprotected write timed out | No response arrived | Determine whether it committed before sending another operation |
| Validation error | VALIDATION | No, unless the business input changes |
| Insufficient funds | INSUFFICIENT_FUNDS | No, unless the business input changes |
| Idempotency conflict | IDEMPOTENCY_KEY_CONFLICT | No; investigate key reuse |
| Payload too large | BODY_TOO_LARGE, BULK_SIZE_EXCEEDED | No; split the payload |
| Internal error with correlation ID | INTERNAL_ERROR | Do not loop; record the request and involve the operator |
Always cap the number of attempts or total elapsed time. Repeated leader loss, overload, or storage pressure requires an operational response rather than an unlimited client loop.
Gates for publication#
Keep this page hidden until:
- the release OpenAPI parses and defines one error schema and response set for every published operation, including
405and413; - regression tests pin
Retry-After: 1on every503path, including the bulk aggregator, and pin its absence on429; - idempotency tests cover replay, conflicting content, retention expiry, and the cluster-wide key namespace;
- SDK guidance implements bounded exponential backoff with jitter, a deadline,
Retry-Afterhandling on503, anderrorCodebranching within each status; - failure tests cover leader loss, overload, committed-but-timed-out writes, validation errors, and internal correlation IDs.