The response
Produced in our test harness by making the rate-limit store fail, as an outage would:
{
"request_id": "req_01M8RK47X82KNA02TP97WE0JGV",
"error": { "code": "INTERNAL_ERROR", "message": "Unexpected server error" }
}The message is the same for every 500, by design: it never includes the underlying exception, which could leak internals. Everything we need is keyed by the request_id, also sent as the x-request-id response header. Each 500 is reported to our error tracking automatically, so you do not need to tell us it happened - only if it keeps happening.
Retrying safely
Calculation endpoints have no side effects, so retrying them is safe. Endpoints that start a job (bulk matching, PDF reports) do: send an Idempotency-Key with them, and a retry after an ambiguous failure gets the original report id back instead of starting a second job (see IDEMPOTENCY_KEY_REUSED).
import random, time, requests
RETRYABLE = {500, 502, 504}
def post(path, body, key, attempts=4):
for n in range(attempts):
r = requests.post(f"https://api.astronode.dev{path}", json=body,
headers={"Authorization": f"Bearer {key}"}, timeout=30)
if r.status_code not in RETRYABLE or n == attempts - 1:
return r
time.sleep(2 ** n + random.random()) # 1s, 2s, 4s (+ jitter)Do not put 4xx codes in the retry set: a 400 or 403 will fail identically every time - refusals are not billed, but they burn your per-minute window and your time. A 429 needs its own wait, read from its Retry-After header. 5xx responses are never billed either.
Reporting a persistent 500
- The
request_idof one failing call (it starts withreq_). - The endpoint, and the request body if you can share it - a 500 that repeats for one input is usually a bug in handling that input.
- Whether it started at a specific time. Check the changelog first.
Input-specific 500s are bugs we turn into 400s with a reason. The polar-latitude cases are the precedent: Placidus houses above the Arctic Circle used to fail with a 500 and now return a 400 that explains why.
Chat: upstream model errors
POST /v1/chat/respond depends on a language-model provider. When the provider fails it answers 502 LLM_PROVIDER_ERROR; when the provider does not answer in time, 504 LLM_TIMEOUT. Both use the chat envelope ("success": false) and both are worth one or two retries with backoff - the same loop as above.