OriginChainDB

Handle errors without repeating writes

Start with the HTTP status and error message. They tell you whether to fix the request, check permissions or try again. A failed connection does not prove that a write failed, so verify its outcome before repeating it.

Respond to the error you actually receivedA lost response does not prove a write failed; reconcile its outcome before repeating it.
  1. Keep the error detailsRecord the status, message and trace ID without secrets.
  2. Classify the failureSeparate invalid input, missing access, limits and temporary failures.
  3. Choose the appropriate actionCorrect the request, back off or inspect the write outcome.
  4. Verify the resultConfirm the operation’s state before continuing dependent work.

Read the complete response

HTTP errors do not all use one JSON envelope. Engine, management, compatibility adapters and gateways can return different fields or plain text. Check the HTTP status first, parse JSON only when appropriate, and retain the request ID from the response headers. An error may use code, error or class; do not assume a retry field exists.

For support, record the endpoint, time, status, SDK version and X-OC-Request-Id when present. Query execution may also provide X-OC-Query-Id. Remove tokens, database keys and private data before sharing logs.

Choose the next action

StatusLikely causeAction
400 / 422Syntax, field, type, dimension or semantic validationRead the returned detail and correct the request.
401 / 403Authentication or permission failureCheck credential type, identity headers and grants. A new token does not grant additional permissions.
404Wrong route or missing/hidden resourceCheck host, tenant, table and key. Restricted objects may be hidden.
409Conflict, duplicate key or transaction validationDistinguish a permanent constraint violation from a concurrency conflict. Re-read and recompute before retrying a conflict.
413Request or operation size limitSplit the work according to the endpoint’s batching contract.
429Rate or capacity limitHonor Retry-After when supplied; reduce concurrency.
501Unsupported feature or deployment modeUse a supported operation; repeating it unchanged will not enable support.
500 / 502 / 503 / 504Server, gateway, capacity or timeout failureInspect the error and retry hint. Retry reads with bounded backoff; reconcile uncertain writes first.

Retry only when safe

Check the retry behavior of your installed SDK. Do not automatically replay a write unless the endpoint explicitly supports deduplication for that operation. A new key on a later request does not identify it as the same operation, and an idempotency header alone does not make arbitrary SQL safe to repeat.

  1. For reads, use bounded exponential backoff with jitter and a total deadline when the failure is transient.
  2. Respect Retry-After if provided. Do not use an unbounded retry loop.
  3. For writes, check whether the route supports idempotency. Reuse the same key and payload for the same logical operation when supported.
  4. If the outcome of a write or COMMIT is unknown, read back or reconcile using an application key. Do not blindly rerun the transaction.

SQL clients

Wire clients also report SQLSTATE. Examples include 23505 for a unique constraint, 23503 for a foreign key, 42501 for insufficient privilege, 40001 for a transaction conflict and 0A000 for an unsupported feature. Use the returned code and message together; HTTP status numbers and SQLSTATE are different interfaces.

Find the relevant example

See error examples, limits, troubleshooting and transaction failure handling. Example response bodies illustrate that route; they are not a universal envelope for every endpoint.

© 2026 Silicoyn Technologies Pvt Ltd

On this page