OriginChainDB docs
examples · errors · 19 / 19

19. 502 - engine unreachable

← Errors examples
what this error means

The service received the request but could not reach your instance. It is almost always transient - typically your instance is briefly unreachable while it restarts: a planned config change, a rolling engine deploy, or a writer changeover in an active-passive pair.

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 in that window - a restart, a deploy, or a writer changeover.

POST /v1/tenants/:t/sql - during a restart
curl -X POST "https://$OC_HOST/v1/tenants/$OC_TENANT/sql" \
  -H "Authorization: Bearer $OC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sql": "SELECT id FROM shop.products LIMIT 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. These windows are normally short; anything longer 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
  • A writer changeover in an active-passive pair - a standby takes over as writer. Promotion is operator-driven by default; the engine also has an opt-in automatic promotion path, off by default, which depends on an external restart hook and refuses to promote a standby that is not fully caught up.
  • Planned restart for a config change.
  • A transient network blip inside the service.
  • Engine briefly unresponsive during a heavy compaction.
  • A rolling deploy of the engine binary.