Fix Claude Code 'API Error: Request timed out' Retry Loop on Linux
Error message
Claude Code: constantly seeing 'API Error (Request timed out...)' - Retrying in .. seconds.. (attempt x/10)'
This error means Claude Code is unable to complete an API call to Anthropic's servers within the expected time window, causing it to enter a retry loop that can exhaust all 10 attempts and leave the tool unresponsive. The most common cause reported by users is a version-specific bug introduced in Claude Code 0.3.5 that primarily affects Linux environments, though network configuration issues can also trigger the same behavior.
The exact error message appears as:
API Error: Request timed out.
Followed by a retry countdown:
API Error (Request timed out.) · Retrying in 1 seconds… (attempt 1/10)
API Error (Request timed out.) · Retrying in 1 seconds… (attempt 2/10)
API Error (Request timed out.) · Retrying in 2 seconds… (attempt 3/10)
API Error (Request timed out.) · Retrying in 5 seconds… (attempt 4/10)
API Error (Request timed out.) · Retrying in 9 seconds… (attempt 5/10)
API Error (Request timed out.) · Retrying in 17 seconds… (attempt 6/10)
API Error (Request timed out.) · Retrying in 36 seconds… (attempt 7/10)
API Error (Request timed out.) · Retrying in 40 seconds… (attempt 8/10)
API Error (Request timed out.) · Retrying in 1 seconds… (attempt 1/10)
API Error (Request timed out.) · Retrying in 1 seconds… (attempt 2/10)
API Error (Request timed out.) · Retrying in 2 seconds… (attempt 3/10)
API Error (Request timed out.) · Retrying in 4 seconds… (attempt 4/10)
API Error (Request timed out.) · Retrying in 40 seconds… (attempt 9/10)
API Error (Request timed out.) · Retrying in 8 seconds… (attempt 5/10)
API Error (Request timed out.) · Retrying in 20 seconds… (attempt 6/10)
API Error (Request timed out.) · Retrying in 34 seconds… (attempt 7/10)
API Error (Request timed out.) · Retrying in 39 seconds… (attempt 8/10)
API Error (Request timed out.) · Retrying in 37 seconds… (attempt 9/10)
API Error (Request timed out.) · Retrying in 35 seconds… (attempt 10/10)
As shown in the community report from the GitHub issue, the retry backoff starts at 1 second and increases to around 40 seconds, but the error continues to recur across multiple retry cycles. After attempt 10/10, Claude Code stops trying and the session becomes stuck.
What Causes This Error
1. Version-specific bug in Claude Code 0.3.5 (most common)
According to the GitHub issue reporter, the problem began roughly 48 hours after updating to Claude Code version 0.3.5. The issue occurs on Ubuntu 24.04 x64 and other Linux distributions, but the same reporter notes that macOS and WSL (Windows Subsystem for Linux) are not affected. This strongly suggests a platform-specific regression in the Linux build of Claude Code 0.3.5.
The issue reporter was using the Opus model primarily but confirmed that switching to Sonnet (claude-sonnet-4-20250514) produced the same timeout errors. This rules out a model-specific problem.
2. Network connectivity issues (less common)
The official error message "Request timed out" is a generic HTTP timeout indicator. It can be caused by:
- A slow or intermittent internet connection
- Corporate firewalls or VPNs that interfere with API traffic
- DNS resolution problems for the Anthropic API endpoint
- Proxy configurations that add latency
However, the reporter explicitly stated "there are no connectivity issues of which I am aware," and logging out and back in, as well as rebooting the server, did not resolve the problem. This suggests that in most cases the cause is not a simple network outage.
3. Authentication or session corruption
The issue reporter tried logging out and back in, which did not help. The Claude Code status output shows:
Account • /login
L Login Method: Claude Max Account
L Organization:
The empty organization field may be a red herring, but session token corruption could theoretically cause timeout behavior if the API rejects the token slowly rather than immediately.
How to Fix It

Solution 1: Downgrade Claude Code to a stable version (community-recommended)
Since the issue appears to be a regression in version 0.3.5, the most reliable fix reported by the community is to revert to a previous version that did not exhibit the timeout behavior.
To check your current version:
claude --version
Or look at the status output, which shows:
Claude Code Status v1.0.35
L Session ID: 3824b60a-912c-4fad-8492-ad4c76098456
L Currently running: npm-local (1.0.35)
L Invoked: /home/user/.claude/local/node_modules/.bin/claude
L Auto-updates: Yes
L Config install method: local
L Config auto-updates: true
If you installed via npm, you can install a specific earlier version:
npm install -g @anthropic-ai/claude-code@<previous-version>
Replace <previous-version> with a version known to be stable before 0.3.5 (for example, 0.3.4 or 0.3.3). Check the npm registry for available versions:
npm view @anthropic-ai/claude-code versions --json
If you installed via the local auto-update method shown in the status output, you may need to disable auto-updates to prevent re-upgrading:
claude config set auto-updates false
Then manually install the older version using the npm method above.
Solution 2: Switch to macOS or WSL (workaround)
According to the community report, the issue does not occur on macOS or WSL. If you have access to either of those platforms, you can use Claude Code there without encountering the timeout loop. This is a workaround, not a fix, but it confirms the problem is Linux-specific.
Solution 3: Check network configuration (official troubleshooting)
Even though the issue is likely a version bug, you should rule out network problems:
- Test your connection to the Anthropic API:
curl -v https://api.anthropic.com/v1/messages --max-time 10
If this times out, you have a network issue. Check:
- Proxy settings:
echo $HTTP_PROXY $HTTPS_PROXY - DNS resolution:
nslookup api.anthropic.com - Firewall rules that might block outbound HTTPS on port 443
-
Try a different network (e.g., switch from corporate VPN to a personal hotspot).
-
Restart the Claude Code session entirely:
claude session clear
Or kill any hanging processes:
pkill -f claude
Solution 4: Use a different model (partial mitigation)
The issue reporter tried both Opus and Sonnet and saw the same behavior. However, if you are on a version where the bug is model-specific, switching to a faster model like Haiku might reduce the likelihood of timeouts because responses are generated more quickly. This is not a guaranteed fix but is worth trying if you cannot downgrade.
If Nothing Works
If none of the above solutions resolve the issue:
-
Report the bug on the GitHub issue tracker. The relevant issue is at https://github.com/anthropics/claude-code/issues/2728. Add your system details (Linux distribution, kernel version, Claude Code version, network setup) to help the developers diagnose the regression.
-
Use the web interface as a temporary workaround. While Claude Code is the CLI tool, you can access Claude through the web UI at claude.ai for your tasks until the bug is fixed in a future update.
-
Check for updates. The Claude Code team may release a patch (0.3.6 or later) that addresses this timeout issue. Run:
claude update
Or check the GitHub releases page for the latest version notes.
How to Prevent It
- Disable auto-updates if you rely on a stable version for production work. Use:
claude config set auto-updates false
This prevents automatic upgrades to potentially buggy versions. You can manually update after verifying that a new version is stable by checking community reports on GitHub or Reddit.
-
Pin your Claude Code version in CI/CD or shared environments by specifying the exact version in your package.json or installation script.
-
Monitor the GitHub issue tracker for known regressions before upgrading. Subscribe to the repository at https://github.com/anthropics/claude-code to receive notifications about new issues and releases.
-
Test on a non-Linux platform first if you have access to macOS or WSL, as those platforms appear to be unaffected by this particular bug.
-
Keep a fallback session using the web UI or a different tool (like the Anthropic API directly via curl or a Python script) so you are not blocked if Claude Code becomes unusable.
The #1 Claude Newsletter
The most important claude updates, guides, and fixes — one weekly email.
No spam, unsubscribe anytime. Privacy policy
Related Error Solutions
Keep exploring Claude
Claude resources
Latest AI answers
Skip the manual work
Ready-made AI workflows and automation templates — import and run instead of building from scratch.