OriginChain docs
examples · errors · 19 / 19

19. 502 - engine unreachable

← Errors examples
what this error means

The control plane received the request but could not reach the tenant's engine. This is rare and almost always transient - typically the engine is mid-failover (HA promoting a replica) or briefly restarting after a planned config change.

The official SDKs auto-retry on 502 with exponential backoff. If you're calling REST directly, you should too.

what triggers it

Any request that lands during the failover window.

POST /v1/tenants/:t/sql - during failover
curl -X POST "https://$OC_HOST/v1/tenants/$OC_TENANT/sql" \
  -H "Authorization: Bearer $OC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sql": "SELECT 1"}'
the canonical response body
{
  "error": "engine_unreachable",
  "message": "control plane could not reach the engine for this tenant",
  "retry": true,
  "trace_id": "5f4e3d2c-1b0a-9988-7766-554433221100",
  "status_page": "https://status.originchain.ai"
}
how to recover
  • Retry with exponential backoff. Failover usually completes in a few seconds; longer outages will show on the status page.
  • If you're on an SDK, the retry happens automatically - you'll usually only see the 502 in logs as a warning, not as a thrown error.
  • Check status.originchain.ai if retries keep failing for more than a minute.
  • For non-idempotent writes, prefer OCC or a deduping pattern so a retried request doesn't double-apply.
  • retry: true - this is the canonical "retry me" error.
common upstream causes
  • HA failover in progress (primary replaced by a replica).
  • Planned restart for a config change.
  • Network blip between the control plane and the engine.
  • Engine briefly unresponsive during a heavy compaction.
  • A rolling deploy of the engine binary.