[BUG] Claude Code hangs with Unable to connect to API (ECONNRESET) on every prompt — both CLI and in-app, persists across networks and clean reinstall

Resolved 💬 5 comments Opened May 6, 2026 by empty1990-sys Closed Jun 12, 2026

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:

Claude Code CLI version: 2.1.131 (latest as of report)
Also reproduces in Claude Code inside the Claude Mac desktop app
macOS (Apple Silicon, Homebrew at /opt/homebrew)
Node 22 (Homebrew)

Symptom:
Every prompt — even a single hi — immediately fails with:
Unable to connect to API (ECONNRESET)
Claude Code retries automatically and keeps failing. OAuth login completes in the browser, but the post-auth token exchange returns:
OAuth error: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()
Network is verified healthy:

curl -v https://api.anthropic.com/v1/messages → HTTP/2 405 (TLS clean, edge: YUL/Montreal)
curl -v https://console.anthropic.com/v1/oauth/token → HTTP/2 405 (TLS clean)
DNS: router (192.168.1.1), no oddities
No proxy env vars (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY all unset)
No VPN, no security software (Little Snitch / LULU / CrowdStrike / etc.)
Reproduces on home Wi-Fi and iPhone cellular hotspot — rules out ISP/router

Other Anthropic services work fine on the same machine and same network:

Regular Claude chat in the Mac app works perfectly
claude.ai in browser works
Direct API requests via curl work

Things tried (none fixed it):

Full app quit + relaunch
Full Mac restart
Sign out / sign in within the Mac app
rm -rf ~/.claude and re-auth from scratch
rm -rf ~/Library/Application Support/Claude/claude-code
Clean reinstall: removed stale /usr/local/bin/claude symlink (Intel-era install from Feb), reinstalled via npm i -g @anthropic-ai/claude-code to /opt/homebrew
Verified which claude → /opt/homebrew/bin/claude, claude --version → 2.1.131
NODE_OPTIONS="--dns-result-order=ipv4first" (no change)
Switched networks (Wi-Fi → cellular hotspot)

Repro steps:

Launch claude in terminal (or open Claude Code in the Mac app)
Send any prompt
Immediately fails with Unable to connect to API (ECONNRESET) and enters retry loop

Note: symptoms match open issues #13657, #27789, and #35094, which describe ECONNRESET in Claude Code while the network and curl are healthy. Adding another reproducer here.

What Should Happen?

I should be able to use Claude Code.

Error Messages/Logs

Steps to Reproduce

Just using Claude Code.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.131

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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