502 · upstream_timeout

upstream_timeout: the target did not answer in time

upstream_timeout means the connection to the target was made but no complete answer arrived inside the timeout. The attempt reached the network, so it is charged as a trip — the work was done.

Common causes

  • The target is slow or under load and takes longer than your timeout_ms.
  • timeout_ms was set below what the endpoint realistically needs.
  • The target streams a response indefinitely instead of returning a body.

How to fix it

  1. 01Raise timeout_ms for endpoints you know are slow — the ceiling is 30 seconds.
  2. 02Retry with backoff: unlike validation failures, a timeout may succeed on a second attempt.
  3. 03For long-lived streams use a socket ticket rather than a forward.

What it looks like

upstream_timeout
{
  "ok": false,
  "error": { "code": "upstream_timeout", "message": "..." },
  "meta": { "duration_ms": 15000, "target_host": "api.example.com" },
  "quota": { "remaining": 4998, "unit": "trips" }
}

Every error code

Questions about this

Related errors

Try it with 5,000 free trips.

No card, no subscription, and the balance never expires.