⌨️CLAUDE_CODE_MAX_RETRIES
Also known as CLAUDE_CODE_MAX_RETRIES environment variable
It sets how many times a failed request is tried again.
Think of it like
It is like how many times you knock on a door. Then you give up and leave.
Example
Jack's CI should fail fast, not wait through ten retries. He sets 3, and a broken run ends quickly.
Why it matters
Retries ride out short outages, but too many can make a script hang for a long time.
Definition
Example code
bash
export CLAUDE_CODE_MAX_RETRIES=3
claude -p "Run the checks"Common mistake
Key takeaways
- 1Default 10. Tries again.
- 2Stops sooner. When overloaded.
- 3Fallback model. Switches instead.