deadline_exceeded means a run did not finish within its deadline. Read this page when runs time out, to choose a better deadline_ms and to retry safely.
What happened
Route:POST /v1/runs.
Every run has a deadline, set with deadline_ms:
The deadline covers choosing a model and the model call. When it passes in either step, the run fails with this code.
The message always reads “the request deadline passed before a route was chosen”, even when the model call is what timed out. Do not use the message to tell the two apart.
The run was admitted, then failed before the model served it. Your organization is not charged: the run’s hold is released. The run itself is not moved out of
pending, and it stays pending. It is listed by GET /v1/runs and counted under in_flight in GET /v1/usage.
Because of that, a replay with the same Idempotency-Key returns 202 with "state": "pending", never the answer. Retry with a new key.
How to fix
- Raise
deadline_ms, up to120000. Set your HTTP client’s own timeout above it, or your client gives up first and you never see the answer. - Shrink the work. Trim the
state, lowerthink_tokens, lowerdraws, or split a large question set across runs. - Retry with a new
Idempotency-Key.deadline_msis not part of the key’s identity, so the old key replays the pending run (202) instead of running with the new deadline. - If runs time out at the maximum deadline with a small input, retry later with backoff and report the
request_id.
Example
deadline_ms:
Related
- Limits -
deadline_msand every other bound. - Polling - read a run later with
GET /v1/runs/{run_id}. - Idempotency - when to reuse an
Idempotency-Keyand when to send a new one. - Error handling - a status-to-action table and a retry helper for every error.
- Problem codes - every code, its status, and whether a retry can help.