[BUG] Claude Code Persistent Connection Timeouts with "fetch failed" Error - Claude Max Account (v2.0.1)

Resolved 💬 3 comments Opened Oct 1, 2025 by GavBain Closed Oct 5, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code experiences persistent connection timeouts when making API requests. Requests fail with "fetch failed" error after approximately 10 seconds, despite timeout configuration being set to 600000ms (10 minutes). The issue occurs on nearly all requests, making Claude Code unusable.

What Should Happen?

Requests should complete successfully or respect the configured 600000ms timeout
API connections should not fail with "fetch failed" at the network level

Error Messages/Logs

Error Output from Debug Logs
[log_d60910] connection timed out - error; no more retries left
[log_d60910] connection timed out (error; no more retries left) {
  url: 'https://api.anthropic.com/v1/messages?beta=true',
  durationMs: 10415,
  message: 'fetch failed'
}

Steps to Reproduce

  1. Install Claude Code globally via npm: npm install -g @anthropic-ai/claude-code
  2. Login with Claude Max account
  3. Navigate to any project directory
  4. Start Claude Code: claude or ANTHROPIC_LOG=debug claude
  5. Ask any simple question: "What files are in this directory?"
  6. Observe connection timeout after ~10 seconds with "fetch failed" error

Expected Behavior

Requests should complete successfully or respect the configured 600000ms timeout
API connections should not fail with "fetch failed" at the network level

Actual Behavior

Most API requests fail after ~10 seconds with "connection timed out" and "fetch failed"
Occasional requests succeed (showing 200 status), but majority fail
The configured timeout values appear to have no effect
Error shows "no more retries left" despite the failure occurring on initial attempt

Diagnostic Information

Network connectivity tests show no issues:

Ping to api.anthropic.com: 0% packet loss, avg 14.7ms latency
DNS resolution: Working correctly
Node.js HTTPS capabilities: Verified working
Direct curl to API: Successful authentication (401 as expected without key)

API rate limit headers from successful requests show:
'anthropic-ratelimit-unified-status': 'allowed'
'anthropic-ratelimit-unified-5h-status': 'allowed'
'anthropic-ratelimit-unified-7d-status': 'allowed'

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code version: 2.0.1

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Windows Terminal

Additional Information

Environment

Platform: Anthropic API (Claude Max Account)
Claude Code version: 2.0.1
Operating System: Linux (Ubuntu on WSL2, Windows 11)
Node.js version: v22.20.0
Terminal: Standard Linux terminal
Login method: Claude Max Account via OAuth

Configuration Files

~/.claude/settings.json:
json{
"model": "claude-sonnet-4-20250514",
"env": {
"BASH_DEFAULT_TIMEOUT_MS": "900000",
"BASH_MAX_TIMEOUT_MS": "900000",
"ANTHROPIC_TIMEOUT": "300000"
}
}
.claude/settings.local.json (project-level):
json{
"env": {
"BASH_DEFAULT_TIMEOUT_MS": "900000",
"BASH_MAX_TIMEOUT_MS": "900000",
"ANTHROPIC_TIMEOUT": "300000"
}
}

Additional Context

Initially experienced timeout issues that appeared to be related to hitting Opus usage limits
After switching to Sonnet 4 model in configuration, connection issues persisted
Some requests at session start succeed (status 200) but subsequent requests fail
The web interface at claude.ai works perfectly with the same Claude Max account
Issue began occurring consistently; unable to complete even simple operations

System Diagnostics from /config

Installation config mismatch: running npm-global but config says unknown

Potential Related Issues

This may be related to:

#2728 (API timeouts with Claude Code 0.3.5+)
#5615 (Timeout configuration)
#2489 (Timeout waiting errors)
#1717 (Environmental variable timeout issues)

Workaround

Currently using claude.ai web interface as alternative, which works without issues.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗