Claude Code

Keep Claude Retrying Overnight When the API Is Busy

By default Claude Code gives up after ten tries on a busy-API error. The two settings that keep an unattended run alive, how to cap the wait, and the catch

2min read
1prompts to copy
5numbered steps
4sections

When Claude's servers are at capacity, Claude Code retries a failed request up to 10 times with exponential backoff, then shows you the error. If you started a long job and went to bed, that error is where the job stops.

A 529 overloaded error is not your usage limit and doesn't count against your quota. Here's how to keep an unattended run waiting it out.

Step 1: turn on the retry watchdog

  1. Set the environment variable CLAUDE_CODE_RETRY_WATCHDOG to 1 before the run, for example: export CLAUDE_CODE_RETRY_WATCHDOG=1
  2. The docs recommend it for unattended sessions such as CI jobs. With it on, Claude Code retries 429 and 529 capacity errors indefinitely instead of failing after the normal retry count.
  3. Start your job the way you normally do overnight, for example: claude -p "your task here"

Keep reading

Free, for an email.

Unlocks 3 more sections, 1 copy-paste prompt, the document version, and every other guide on the site, for free. Enter your email once to keep reading.

45,000+ follow where these guides come from.No spam. Unsubscribe in one click.

Read next