[BUG] CLI reports ConnectionRefused on all requests while TCP connections to api.anthropic.com are ESTABLISHED (v2.1.227, macOS)

Status Open
Reported on v2.1.227
Maintainer reply None cached
Activity 1 comment · opened Aug 11, 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?

Every request from the Claude Code CLI fails with "API Error: Connection refused — a firewall or proxy may be blocking it (ConnectionRefused)" and retries up to 10 times. This affects plain prompts and slash commands alike.

The error appears to be mislabeled. While a request is hanging, lsof shows multiple ESTABLISHED TCP connections from the claude process to api.anthropic.com on port 443 over both IPv4 and IPv6. Nothing is in SYN_SENT and nothing is being refused at the socket level.

The CLI also successfully fetches account info at startup, displaying the Max plan banner about Fable 5 availability, so authentication and at least some network calls to Anthropic succeed in the same session that then reports ConnectionRefused.

The Claude desktop app works normally on the same machine, same account, same network, at the same time.

What Should Happen?

The CLI should complete the request and return a response, as it does in the Claude desktop app on the same machine, account, and network.

If a request genuinely cannot be completed, the error should accurately describe the failure. ConnectionRefused is misleading here, since the process holds ESTABLISHED TCP connections to api.anthropic.com throughout. That wording sent me down hours of firewall, proxy, DNS, and IPv6 troubleshooting for a problem that was not at the network layer.

Error Messages/Logs

Steps to Reproduce

  1. Launch claude in Terminal.app on macOS
  2. Enter any prompt, e.g. "what is 2+2"
  3. Observe ConnectionRefused error with retry loop

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.227

Claude Code Version

2.1.227

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Network: curl to api.anthropic.com succeeds over both IPv4 and IPv6, full TLS handshake, valid cert
  • DNS: resolves correctly via ISP nameservers
  • Proxy: no HTTP_PROXY/HTTPS_PROXY env vars, scutil --proxy shows none, no VPN or filtering software, scutil --nc list is empty
  • Router/ISP: reproduced on a completely different Wi-Fi network
  • Local config: reproduced after full uninstall and reinstall with ~/.claude and ~/.claude.json deleted
  • Plugins/MCP: reproduced with --strict-mcp-config --mcp-config '{"mcpServers":{}}'
  • Shell alias: reproduced with alias removed and by invoking the binary directly
  • Model: reproduced on both Opus 5 (1M context) and Sonnet 5
  • Auth: reproduced after deleting credentials and re-authenticating

<img width="1504" height="1114" alt="Image" src="https://github.com/user-attachments/assets/9efc990e-0852-4dbb-9068-bcb4149e158a" />
tried different wifi, terminals, fresh installs, nothing.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗