Home / Blog / Pricing

Pricing

Claude Code "Unable to Connect to API (ECONNRESET)": Fixes

Claude Code shows 'Unable to connect to API (ECONNRESET)'? Check status first, then proxy, VPN and network settings, in order, with official docs cited.

8 min read

Error meaning, retry behavior and fixes checked Nov 1, 2026 in Anthropic’s Claude Code error reference and Claude Code network configuration docs. The raw error strings are quoted from GitHub issue #69242 and GitHub issue #100068 (both verified Oct 31, 2026). All sources are listed at the bottom. No affiliate links on this page (how we work).

The exact error: API Error: Unable to connect to API (ECONNRESET)

Here’s the line people search for:

API Error: Unable to connect to API (ECONNRESET)

That’s quoted from GitHub issue #69242 (verified Oct 31, 2026), on Claude Code 2.1.177. The fuller form, after Claude Code has used up its retries, comes from issue #100068 (verified Oct 31, 2026), on 2.1.200:

Unable to connect to API (ECONNRESET) · Retrying in 27s · attempt 10/10

The one-line answer (as of Nov 1, 2026): the network connection between your machine and Anthropic’s API dropped before a reply came back. Anthropic’s error reference files it under “Unable to connect to API”: “The TCP connection to the API failed or never completed.” It isn’t an auth error, it isn’t your usage limit, and it isn’t the 529 overload error.

Newer builds say it more plainly. Since v2.1.227, the same failure reads:

Connection dropped (ECONNRESET)

Anthropic’s docs: “Before v2.1.227, each of these coded messages read Unable to connect to API followed by the code” (error reference, verified Nov 1, 2026). So if you see either wording, you’re on the right page.

Is it Anthropic or you? Check status first

Thirty seconds, two checks, before you touch any settings:

  1. Open status.claude.com. Anthropic’s error reference points there for active incidents. If something’s red, your config is fine and the fix is waiting. We’re not quoting a live status here because it changes by the minute; the page itself is the source.
  2. Run Anthropic’s own reachability test from the same terminal:
curl -I https://api.anthropic.com

On Windows PowerShell, use curl.exe -I https://api.anthropic.com so the built-in Invoke-WebRequest alias isn’t used (error reference, verified Nov 1, 2026).

If curl fails too, it’s your network path: Wi-Fi, VPN, proxy or firewall. If curl works and Claude Code still fails, Anthropic says “the cause is usually something between the runtime and the network rather than the network itself.” That second case is the sneaky one, and it has its own section below.

Also know that Claude Code doesn’t fail on the first wobble. It “retries transient failures up to 10 times with exponential backoff before showing you an error”, and a connection dropped before any of the reply streamed is simply re-sent. That’s the Retrying in 27s · attempt 10/10 countdown. By the time you see the error, ten attempts have already failed. One blip is not your problem; ten in a row is a pattern.

Fixes in order

Every fix here comes from Anthropic’s Claude Code docs, verified Nov 1, 2026, except step 5, which is labeled.

1. Retry once. Intermittent failures are retried automatically, so a single fresh attempt after a minute is reasonable. If the same prompt fails ten-out-of-ten again, move on. Claude Code has already done its Sheldon Cooper routine from The Big Bang Theory, knocking and calling “Penny” over and over; if nobody answered after ten knocks, the eleventh won’t change much.

2. Behind a corporate proxy? Set HTTPS_PROXY before launching Claude Code.

export HTTPS_PROXY=https://proxy.example.com:8080

The network docs list HTTPS_PROXY (recommended), HTTP_PROXY and NO_PROXY, and lowercase versions work too. Two documented gotchas: “Claude Code does not support SOCKS proxies”, and a proxy URL without a scheme stops Claude Code at launch. If your proxy inspects TLS with its own certificate, point NODE_EXTRA_CA_CERTS at that CA file. Check what Claude Code actually picked up in the Proxy row of /status.

3. Allow Anthropic’s hosts through the firewall. The network access requirements list api.anthropic.com, claude.ai, claude.com, platform.claude.com, mcp-proxy.anthropic.com, downloads.claude.ai and storage.googleapis.com, plus registry.npmjs.org if you installed via npm. Hand that list to IT as-is.

4. Check the VPN. Anthropic names “a VPN that blocks api.anthropic.com” among the common causes. On macOS, a VPN client you disconnected or uninstalled “can leave a tunnel interface or routing rule behind”: check ifconfig for stale utun interfaces and remove the VPN’s network extension in System Settings.

5. Try a different network. Not an official fix, just a clean test of step 1’s question: is it this network? In issue #100068, the reporter wrote that the same machine connected first time over a phone hotspot and failed on home Wi-Fi, and their own packet capture showed the reset packets coming from the API’s address. That’s one user’s analysis with no reply from Anthropic in the issue as of Nov 1, 2026, so treat it as a data point, not a diagnosis.

6. Update Claude Code. Run claude update. Several fixes in this part of the docs are tied to versions, for example a Windows corporate-proxy “Socket is closed” error fixed in v2.1.214. If you’re on 2.1.177 like issue #69242, you’re a long way behind.

7. Still stuck? Report it properly. Run /feedback inside Claude Code to send the transcript to Anthropic, or claude doctor from your shell for a read-only diagnostic, then search existing issues. For the support-ticket version of your logs, claude --debug writes a debug log you can attach.

If curl works but Claude Code doesn’t

Anthropic’s four suspects, in its order (error reference, verified Nov 1, 2026):

  • A leftover ANTHROPIC_BASE_URL. Run echo $ANTHROPIC_BASE_URL and check the env block of your settings files. If it’s set, Claude Code sends requests there instead of api.anthropic.com. A forgotten local gateway is the classic case.
  • A broken resolver on Linux or WSL. Check /etc/resolv.conf for an unreachable nameserver.
  • Stale VPN leftovers on macOS. The utun check from fix 4.
  • Docker Desktop or similar runtimes. They “can intercept outbound traffic”. Quit them and retry.

If you route through an LLM gateway on purpose and every request ends in Connection dropped, Anthropic suggests testing with ENABLE_TOOL_SEARCH=false, because some gateways reject the tool search fields Claude Code sends by default.

Debugging this feels like Chandler stuck in the ATM vestibule in Friends’ “The One with the Blackout”: everything should be working, the city went dark around you, and the guy who can help is the last one you’d ask.

ECONNRESET vs ConnectionRefused vs timed out vs 529

ErrorUsually meansFirst fix
ECONNRESETConnection droppedcurl check, VPN
ConnectionRefusedFirewall or proxyProxy settings
ENOTFOUNDDNS lookup failedCheck DNS
Request timed outNo reply in timeRetry, API_TIMEOUT_MS
529 OverloadedAnthropic busyWait, status

Sources: Claude Code error reference, verified Nov 1, 2026 (network rows) and Oct 30, 2026 (529 row).

The detail behind each row, from the same docs:

  • ConnectionRefused reads Connection refused — a firewall or proxy may be blocking it (ConnectionRefused) in current builds. A dead local gateway left in ANTHROPIC_BASE_URL is a documented cause.
  • ENOTFOUND reads Can't reach the API server — check your internet or DNS (ENOTFOUND).
  • Request timed out: “The API didn’t respond before the connection deadline.” The default request timeout is 10 minutes; if a slow network or proxy is the cause, Anthropic says to raise API_TIMEOUT_MS.
  • 529: Anthropic’s servers are at capacity, and it doesn’t count against your quota. Full walkthrough in Claude Code 529 overloaded.

If the error mentions an API key or authentication, that’s Claude Code invalid API key. If it says session or weekly limit, that’s your plan: Claude Code usage limits.

There’s also a mid-reply cousin: API Error: Connection lost mid-response. The response above may be incomplete. Claude Code shows that when the connection drops after Claude has already completed some text or a tool call, and keeps the partial output instead of re-running tools twice. Same network causes, different timing.

Here’s what I’d do

Check status.claude.com, then run the curl line. Curl fails: fix the network path, starting with the VPN and the proxy variables. Curl works: look for a stale ANTHROPIC_BASE_URL before anything else, because it’s the one Anthropic calls out first and the easiest to forget. Then claude update, because an old build is a cheap thing to rule out. If you’re on a locked-down corporate network, send IT the host list rather than guessing. And if a deadline can’t wait for IT, Claude Code alternatives and AI coding tools compared list other tools with dated prices; your plan costs are on Claude pricing.

If the message is “The operation timed out” instead, see the Claude Code timeout fix.

ConnectionRefused is a different connect failure from ECONNRESET: Claude Code unable to connect (ConnectionRefused).

FAQ

What does API Error: Unable to connect to API (ECONNRESET) mean in Claude Code? The network connection to Anthropic’s API dropped before a reply arrived, after Claude Code had already retried up to 10 times; newer builds call it “Connection dropped (ECONNRESET)”.

Is Claude Code down? Check status.claude.com for active incidents; if it’s clear and curl -I https://api.anthropic.com fails from your terminal, the problem is on your network path.

Does a VPN cause ECONNRESET? It can; Anthropic lists a VPN that blocks api.anthropic.com as a common cause of connection errors, and stale VPN interfaces on macOS as another.

Does Claude Code support SOCKS proxies? No, Anthropic’s network docs say Claude Code does not support SOCKS proxies; use an HTTP or HTTPS proxy via HTTPS_PROXY.

Does ECONNRESET use up my Claude usage limit? Anthropic doesn’t publish a rule for failed connections; the docs only say a 529 doesn’t count against your quota, so check /usage if you’re worried.

Sources

  1. GitHub issue #69242 (verbatim “API Error: Unable to connect to API (ECONNRESET)”, v2.1.177): https://github.com/anthropics/claude-code/issues/69242 (verified 2026-10-31, re-read 2026-11-01)
  2. GitHub issue #100068 (retry countdown string, v2.1.200, reporter’s hotspot and packet-capture notes): https://github.com/anthropics/claude-code/issues/100068 (verified 2026-10-31, re-read 2026-11-01)
  3. Claude Code error reference (Unable to connect to API, Automatic retries, Request timed out, mid-response notices, Report an error): https://code.claude.com/docs/en/errors (verified 2026-11-01)
  4. Claude Code network configuration (proxy variables, SOCKS, CA certificates, network access requirements): https://code.claude.com/docs/en/network-config (verified 2026-11-01)
  5. Claude status page: https://status.claude.com (reachable 2026-11-01; no live status quoted)
  6. Claude Code error reference, 529 overloaded (529 meaning and quota rule): https://code.claude.com/docs/en/errors (verified 2026-10-30)

Related reading