[BUG] ECONNRESET / "Unable to connect to API" — Claude Code client fails while curl, Node, and the network all succeed (Windows native v2.1.150 + desktop app)
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?
Environment: Windows, wired Ethernet (Realtek 2.5GbE), Claude Code native install v2.1.150, also reproduced in the Claude Desktop app's bundled Code engine.
Symptom: Sessions hang with no streaming output for minutes, then either eventually answer or fail with API Error: Unable to connect to API (ECONNRESET). Intermittent and worsens over a session. Full process kill + relaunch clears it only briefly before it recurs — consistent with stale HTTP/2 connection-pool reuse (see #23744).
The network and machine are provably fine — confirmed at the same moment the client was failing:
ping api.anthropic.com (160.79.104.10) → 50/50 packets, 0% loss, 15–39ms.
curl https://api.anthropic.com/v1/messages → 405 in ~0.1s.
Plain Node https.request to the same endpoint → 401 (connects cleanly).
Only Claude Code's bundled HTTP client throws ECONNRESET. curl + Node + ICMP all succeed simultaneously.
Ruled out (systematically):
Broken/unrouted ISP IPv6 — found and disabled at the adapter (curl -6 went 21s-hang → 22ms-fail). Did not fix the Claude Code issue.
Proxy — none (WinINET ProxyEnable=0, WinHTTP direct, no proxy env vars).
Antivirus — Malwarebytes Web Protection disabled, no change. Windows Defender disabled, no change.
Want to note - this has periodically happened (seemingly near midnight most days) for the last week or so, but yesterday was the first time it basically has comepletely stopped working and nothing seems to fix it. i updated the desktop client to the newest version last night and pretty close to since then this has been an unfixable issue.
What Should Happen?
Claude should be working normally, and not taking 25 minutes to respond to basic questions. When asked about errors, the broken sessions say they have no errors at all, depspite clearly being broken.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce — Claude Code ECONNRESET (client-side; network verified healthy)
Environment
OS: Windows (wired Ethernet — Realtek PCIe 2.5GbE)
Claude Code: native install, v2.1.150
Also reproduces in: the Claude Desktop app's bundled Code engine
Network: home broadband, no VPN, no proxy
Reproduction
Run the Windows native Claude Code build (v2.1.150). Reproduces both in the standalone CLI and in the Claude Desktop app's integrated Code sessions.
Start a session and use it normally over multiple turns / ongoing work.
Observe the failure: the session stops streaming, the spinner runs for an extended period (observed 10+ minutes with no output), then either (a) eventually returns the response, or (b) fails with:
API Error: Unable to connect to API (ECONNRESET)
The behavior is intermittent and degrades over the life of a session — fresh sessions may work briefly, then begin hanging/resetting after a few turns.
While the client is hanging/resetting, confirm the network and machine are healthy from the same machine, at the same time:
ICMP — ping api.anthropic.com → 50/50 replies, 0% loss, 15–39 ms.
curl — curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" https://api.anthropic.com/v1/messages → 405 in ~0.1 s.
Node — node -e "const https=require('https');const r=https.request('https://api.anthropic.com/v1/messages',{method:'POST'},res=>{console.log('status',res.statusCode);res.on('data',()=>{})});r.on('error',e=>console.log('ERROR',e.message));r.end();" → status 401.
Result: curl, Node, and ICMP all succeed simultaneously; only the Claude Code client throws ECONNRESET.
Rule out the local environment (all performed; ECONNRESET persisted after each):
IPv6 — broken/unrouted ISP IPv6 identified (curl -6 hung 21 s, then failed) and disabled at the adapter (Disable-NetAdapterBinding -ComponentID ms_tcpip6); verified curl -6 now fails in ~22 ms and curl -4 returns 405 in ~0.1 s. Did not resolve the Claude Code issue.
Proxy — none. WinINET ProxyEnable=0; netsh winhttp show proxy → "Direct access"; no *_PROXY environment variables.
Antivirus — Malwarebytes Web Protection disabled; no change.
Restart behavior: fully terminate all claude processes and relaunch. The client works briefly, then the hang/ECONNRESET recurs — consistent with stale HTTP/2 connection-pool reuse.
Expected
Claude Code maintains a working connection to api.anthropic.com whenever curl, Node, and ICMP can reach it from the same machine.
Actual
Claude Code's bundled HTTP client hangs and then throws ECONNRESET while every other client on the machine connects normally.
Notes
Network, machine network stack, IPv6 config, proxy, and antivirus are all eliminated, which isolates the fault to Claude Code's bundled HTTP client. Suspected stale HTTP/2 connection-pool reuse — consider force-closing the connection pool on ECONNRESET before retrying rather than reusing a dead socket, and/or exposing an option to force HTTP/1.1. Likely related: #38977, #13657, #23744, #35094.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.150
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
ONLY happens to desktop Claude app - my vscode sessions work just fine, so node works but the electron app is causing problems somehow.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗