[BUG] ECONNRESET on all local sessions (CLI + desktop) while curl and undici reach the same hosts successfully — macOS arm64, v2.1.251
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?
Every local Claude Code session fails to connect with ECONNRESET — both the macOS desktop app's Local mode and a freshly npm-installed standalone CLI (2.1.251). All models, all reasoning levels, new and existing sessions, and /doctor. Cloud sessions and Cowork from the same machine work normally.
From the same shell, seconds apart, curl and Node's own fetch() (undici — the HTTP stack Claude Code uses) reach both startup-probe hosts successfully. So undici succeeds where the undici-based client resets.
Ruled out: --safe-mode (same error), empty CLAUDE_CONFIG_DIR with no ANTHROPIC_API_KEY (same error, and it never reaches the login prompt — so the probe fails pre-auth), no proxy, no network system extensions, IPv6 disabled, tested on home Wi-Fi and a phone hotspot, sign-out/in, keychain credential deletion, binary re-download.
What Should Happen?
Claude Code should connect to api.anthropic.com and start a session, as it does from the same machine via curl, Node https.request, and Node fetch().
Error Messages/Logs
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ECONNRESET
Desktop app: Request failed · Retrying (n/10) — exhausts all 10 retries
Expanding "Connection problem" shows: API Error: Connection dropped (ECONNRESET)
Desktop app logs (14/14 send attempts):
[rcAutoEnable] verdict: enable=true source=gb_default trigger=first_turn
Enabling remote control for session local_e9c22f45-...
[remote-control] bridge_state: "failed" — "Session creation failed"
Also recurring: remote_cowork.sign_for_session_header_failed
Once: OAuthError: Unable to start session. Sign in again: session_stale_relogin
Same machine, same minute — all succeed:
curl -4 --http1.1 api.anthropic.com/v1/messages -> 405
curl -4 --http2 api.anthropic.com/v1/messages -> 405
curl -4 POST 300KB api.anthropic.com/v1/messages -> 401
curl -4 platform.claude.com/ -> 200
node https.request api.anthropic.com/v1/messages -> 401
node fetch() api.anthropic.com/v1/messages -> 401
node fetch() platform.claude.com/ -> 200
Steps to Reproduce
- npm i -g @anthropic-ai/claude-code (v2.1.251) on macOS 26, Apple Silicon
- cd into any project folder and run claude
- Fails immediately with Failed to connect to api.anthropic.com: ECONNRESET
- In the same shell, curl -4 https://api.anthropic.com/v1/messages returns 405 and node -e "fetch('https://api.anthropic.com/v1/messages',{method:'POST',body:'{}'}).then(r=>console.log(r.status))" returns 401
- Persists with claude --safe-mode and with CLAUDE_CONFIG_DIR=$(mktemp -d) env -u ANTHROPIC_API_KEY claude
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.251 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Also reproduces in the Claude desktop app (1.40609.0, CCD 2.1.247) with its own bundled runtime, so it isn't specific to the npm install. Cloud sessions and Cowork from the same machine work normally — only locally-executed sessions fail.
Possibly related: #86473, #87424, #71436, #56140, #48008.