[BUG] ECONNRESET recurs on Claude Code CLI while curl succeeds simultaneously (v2.1.209, arm64 macOS)
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 CLI repeatedly fails with Unable to connect to API (ECONNRESET) and enters a retry loop during normal use. At the exact moment of failure, a curl request to the same endpoint from the same machine succeeds immediately with no errors — ruling out network, DNS, TLS, and server-side causes. This looks like the same "stale HTTP/2 connection-pool reuse" issue described in #23744 and #62045 (the latter was auto-closed as stale, but the bug still reproduces on a newer version).
What Should Happen?
Claude Code should connect and work normally without ECONNRESET errors. Based on the diagnostics below, the likely cause is that it fails to detect a dead/stale connection and doesn't open a fresh one.
Error Messages/Logs
=====
□ claude CLI
✻ Unable to connect to API (ECONNRESET) · Retrying in 2s · attempt 3/10
=====
=====
□ Manual diagnostics (run at the same moment)
$ ping api.anthropic.com
8 packets transmitted, 8 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 7.101/7.777/10.242/0.964 ms
$ curl -v https://api.anthropic.com/
* Connected to api.anthropic.com (160.79.104.10) port 443
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* using HTTP/2
< HTTP/2 404
(curl succeeded with no errors at the same moment Claude Code showed ECONNRESET)
=====
Steps to Reproduce
- Use Claude Code CLI normally over a session (not tied to a network switch)
- Eventually see:
✻ Unable to connect to API (ECONNRESET) · Retrying in Ns · attempt N/10 - Immediately run
curl -v https://api.anthropic.com/in the same terminal — it succeeds
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.209
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗