The whole hunk
from line 191, old and new numbered
/
lines
from line 191
191191
192192When an API request fails with a retryable error, Claude Code emits a `system/api_retry` event before retrying. On v2.1.246 or later, when a `401` or `403` rejects an [`apiKeyHelper`](/docs/en/settings-reference#apikeyhelper) credential, Claude Code makes the first two retries quietly with no event, then emits the event as usual from the third consecutive retry onward. The quiet retries still count toward `attempt`. You can use the event to show retry progress in your own interface.
193193
194| Field | Type | Description |
195| ---------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
196| `type` | `"system"` | message type |
197| `subtype` | `"api_retry"` | identifies this as a retry event |
198| `attempt` | integer | current attempt number, starting at 1 |
199| `max_retries` | integer | total retries permitted |
200| `retry_delay_ms` | integer | milliseconds until the next attempt |
201| `error_status` | integer or null | HTTP status code, or `null` for connection errors with no HTTP response |
202| `error` | string | error category: `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `rate_limit`, `overloaded`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, or `unknown` |
203| `uuid` | string | unique event identifier |
204| `session_id` | string | session the event belongs to |
194| Field | Type | Description |
195| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
196| `type` | `"system"` | message type |
197| `subtype` | `"api_retry"` | identifies this as a retry event |
198| `attempt` | integer | current attempt number, starting at 1 |
199| `max_retries` | integer | total retries permitted |
200| `retry_delay_ms` | integer | milliseconds until the next attempt |
201| `error_status` | integer or null | HTTP status code, or `null` for connection errors with no HTTP response |
202| `no_response` | object, optional | present only when the failed attempt got [no response headers in time](/docs/en/errors#no-response-from-api). `waited_ms` is how long that attempt waited and `retry_wait_ms` is how long the retry will wait. In these events, `max_retries` reflects the one retry this cause normally gets, not the session-wide budget. Requires Claude Code v2.1.261 or later |
203| `error` | string | error category: `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `rate_limit`, `overloaded`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, or `unknown` |
204| `uuid` | string | unique event identifier |
205| `session_id` | string | session the event belongs to |
205206
206207#### Read session metadata
207208