OriginChainDB

API errors

Read the HTTP status and response body, identify the cause, and decide what to fix before retrying.

Read the HTTP status and the response body together. The status identifies the kind of failure; the body may explain which input, permission or resource caused it.

Diagnose before repeating a requestA lost write response can leave the outcome uncertain.
  1. Read the HTTP statusDistinguish rejected input from access or service failures.
  2. Inspect the responseFind the field, permission or resource involved.
  3. Decide the next actionFix the cause; verify uncertain writes before retrying.
  • 2xx: Read the result. 202 can acknowledge work that is still running. For a partial-write 207, inspect both inserted and error.
  • 4xx: Check the request or access. For 429, honor Retry-After.
  • 5xx: Check the outcome before retrying a write; it may already have applied.

Read the error body

The error value can be a message string or an object.

Optional fields vary by route; do not assume a universal error code.

Synthetic examples show the envelope, not guaranteed error messages or class names.

{
  "error": "Example invalid request",
  "class": "example_error_class"
}

Find the status code

Each endpoint lists its own documented status codes.

StatusWhat to do
400Correct the request before retrying.
401Check the credential and Authorization header.
402Check feature access or available credits.
403Check tenant access, roles and permissions.
404Check the resource ID and API route.
408Reduce query work or adjust the timeout.
409Resolve the conflict before retrying.
412Refresh the version or ETag before writing again.
413Split or reduce the request body.
415Send the required Content-Type.
422Correct the values or unsupported combination.
429Honor Retry-After when present; back off.
499The client cancelled the request.
500Check the outcome before retrying a write.
501Check deployment support for this operation.
502Check service availability and the write outcome.
503Honor Retry-After when present; check write outcomes.
{
  "error": "Invalid request: check the fields and values."
}

Correct the request before retrying.

Handle errors in your application

Parse the body safely and preserve the HTTP status.

Do not retry writes automatically. Check the endpoint's retry contract and whether the first request already changed data.

Row idempotency

// Node.js 20+ ยท handle both error shapes and empty responses.
const response = await fetch(url, options);
const text = await response.text();
let body;
try { body = text ? JSON.parse(text) : null; }
catch { body = text; }

if (!response.ok) {
  const error = body && typeof body === 'object' ? body.error : body;
  const message = typeof error === 'string'
    ? error : error?.message ?? 'Request failed';
  console.error(response.status, message);
  // Retry only when the operation and outcome make it safe.
  throw new Error(message);
}

if (response.status === 207) {
  // Partial NDJSON write: inspect inserted and error; committed rows remain.
  console.log(body);
} else {
  console.log(body);
}
ยฉ 2026 Silicoyn Technologies Pvt Ltd

On this page