[BUG] Persistent "Unable to connect to API (ConnectionRefused)" on macOS — Claude Code and Claude Cowork both fail while Claude.ai web works
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?
On macOS (Mac mini M4), Claude Code repeatedly fails with:Unable to connect to API (ConnectionRefused)
followed by an indefinite retry loop (Retrying in N seconds… (attempt X/10)).
Claude Cowork on the same machine also fails to start.
Meanwhile, Claude.ai in the browser works normally on the same machine and same network, confirming that local networking, ISP, DNS, and account credentials are all healthy. This narrows the problem to the Claude Code / Cowork client stack.
The official status page (https://status.claude.com) currently reports "no incidents," but May 4, 2026 (UTC) had multiple incidents affecting Claude API, Claude Code, and Claude Cowork. The current symptom appears to be residual fallout from those incidents, but it is not acknowledged on the status page.
This pattern matches several previous reports that were closed without a sustained fix:
- #16331 — Claude Code ConnectionRefused (Jan 2026)
- #17541 — Connection Refused despite successful curl, suggesting Bun HTTP client issue (Jan 2026)
- #33355 — Closed as not planned (Mar 2026)
Environment Info
- Platform: darwin (Mac mini M4)
- Claude Code version: v2.1.128
- macOS version: 26.4.1(25E253)
- Terminal:2.15 (470)
- Account type: <Max / API>
Steps to Reproduce
- Launch
claudein Terminal - Any prompt — or even
claude --model claude-sonnet-4-5— triggers:
Unable to connect to API (ConnectionRefused) with a retry loop
- Claude Cowork app on the same machine also fails to authenticate
- Browser-based Claude.ai on the same machine works perfectly
Expected Behavior
Claude Code should connect to the Anthropic API and respond normally, given that the network and account are confirmed healthy via Claude.ai web.
Impact
- Time-sensitive professional work is blocked.
- Falling back to the web interface is not always feasible because Claude Code's file/folder access is essential to the workflow.
- The recurring "ConnectionRefused" pattern across many months suggests an unresolved root cause (possibly the Bun HTTP client per #17541) that warrants reopening rather than per-incident closure.
Request
- Please re-investigate the recurring ConnectionRefused symptom on macOS.
- If this is downstream of the May 4, 2026 incidents, please update the status page accordingly.
- If it is a client-side bug (Bun HTTP client / subscription auth flow), please consider reopening #17541 and #16331 for active tracking, since multiple users continue to experience the same symptom long after each individual issue is closed.
What Should Happen?
Claude Code should connect to api.anthropic.com and respond to prompts normally, given that:
- The network and DNS are healthy (Claude.ai in the browser works on the same machine and network)
- The account credentials are valid (login on Claude.ai succeeds)
- Other Anthropic services are reachable (curl https://api.anthropic.com returns expected responses)
The CLI should not enter an indefinite "ConnectionRefused" retry loop while a parallel browser session to the same backend works without issue.
Error Messages/Logs
Terminal output:
Unable to connect to API (ConnectionRefused)
Retrying in 7 seconds… (attempt 1/10)
Retrying in 11 seconds… (attempt 2/10)
…
(loop continues without recovery)
Status page check:
https://status.claude.com → "No incidents reported today" (May 5, 2026)
However, May 4, 2026 had multiple incidents affecting Claude API,
Claude Code, and Claude Cowork that may not be fully resolved on the
client side.
Parallel verification (browser, same machine):
https://claude.ai → works normally, full response received
Note: I was unable to run `/doctor` or `/feedback` because the CLI
cannot start a session.
Steps to Reproduce
- Open Terminal on macOS (Mac mini M4)
- Run: claude
- Enter any prompt (e.g., "hello")
- Observe: "Unable to connect to API (ConnectionRefused). Retrying in N seconds… (attempt X/10)"
- The retry loop continues indefinitely; no successful response is ever returned
- Confirm in parallel that https://claude.ai works normally in the browser on the same machine and the same network
- Confirm Claude Cowork desktop app on the same machine also fails to authenticate
Reproducible across multiple terminal restarts and multiple hours.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.128
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗