Omniscio

OmniscioGuidesENOTFOUND

Claude Code ENOTFOUND: can't reach the API server

Last checked against Anthropic's documentation on November 13, 2026. By the Omniscio team. Updated .

What does the message look like?

Claude Code prints the code in brackets at the end of a plain-language sentence:

Can't reach the API server — check your internet or DNS (ENOTFOUND)

The bracket can read FailedToOpenSocket instead of ENOTFOUND. Both mean the connection never opened, so the same checks apply.

On a version before 2.1.227 the line looked like this, with no description of the code:

Unable to connect to API (ENOTFOUND)

If you are on an older version, run claude update. The newer line names the thing to check, so you do not have to look a code up.

What does ENOTFOUND actually mean?

ENOTFOUND is the name lookup's own error code. Before Claude Code can talk to the API, your computer has to turn the name api.anthropic.com into an address. That lookup failed, so no request was ever sent.

This is worth knowing because it rules things out. Your API key was not checked. Your account was not checked. The model was never asked. Something between your machine and the internet is broken.

Anthropic lists three common causes: no internet access, a VPN that blocks api.anthropic.com, or a required corporate proxy that is not configured.

How do I test the connection in one command?

Run this in the same command window you start Claude Code from: Terminal on a Mac, PowerShell on Windows.

curl -I https://api.anthropic.com

On Windows PowerShell, use curl.exe:

curl.exe -I https://api.anthropic.com

The .exe matters there. Plain curl in PowerShell is really a different command, Invoke-WebRequest, and it can fail in a way that has nothing to do with Claude Code.

An answer of any kind, even an error from the server, means the name resolved and the network is fine. The same failure as Claude Code means the problem is the machine's network or DNS.

Why does curl work but Claude Code still fail?

Then the network is healthy and something between Claude Code and the network is not. Anthropic documents four checks. Use the ones that match your computer and skip the rest.

  1. A leftover ANTHROPIC_BASE_URL. When it is set, Claude Code sends requests there instead of api.anthropic.com, so a value pointing at a proxy or gateway that is no longer running fails even though curl reaches the API. Check with echo $ANTHROPIC_BASE_URL, or echo $env:ANTHROPIC_BASE_URL in PowerShell. Delete the line from the env block of your settings file (~/.claude/settings.json) or from your shell profile (on a Mac, usually ~/.zshrc), then start Claude Code from a new window.
  2. DNS on Linux, or on Windows inside WSL. WSL is the Linux layer some Windows PCs run, and it can take a broken lookup setting from Windows. Open /etc/resolv.conf and read the nameserver lines: an address you do not recognise, or one that no longer exists, is the problem. Ask whoever manages your network to give you a working one.
  3. A stale VPN on macOS. A VPN client that was disconnected or uninstalled can leave a tunnel behind. Restart the Mac, and if the trouble comes back, remove or reinstall that VPN app.
  4. A container runtime. Docker Desktop and similar runtimes can intercept outbound traffic. Quit them and try again to rule that out.

What if I am behind a proxy or a gateway?

Set HTTPS_PROXY before you launch Claude Code, and ask your network team to allow HTTPS through that proxy to api.anthropic.com.

If you route through a gateway or relay, set ANTHROPIC_BASE_URL to the address it was given, either in the env block of your settings file or in front of the command: ANTHROPIC_BASE_URL=https://your-gateway claude. Anthropic's network configuration page lists the other hosts a firewall has to allow.

If you run Claude Code on a rented cloud computer rather than your own, this error can also mean that computer is not allowed to reach Anthropic's servers. Ask whoever set it up to allow api.anthropic.com.

Where these answers come from