Unable to connect to Anthropic services when running "claude" in terminal for claude code

Resolved 💬 51 comments Opened Apr 2, 2025 by mikelibg Closed Aug 22, 2025
💡 Likely answer: A maintainer (sid374, contributor) responded on this thread — see the highlighted reply below.

!Image

Getting the above error when trying to run claude code in terminal from valid country.

Claude version: 0.2.29 (Claude Code)
Node version: v23.6.0
npm version: 10.9.2

Tried running it also with bedrock setup but still getting the same error (btw, even with bedrock setup the error is still for api.anthropic.com)

CLAUDE_CODE_USE_BEDROCK=1
ANTHROPIC_MODEL='us.anthropic.claude-3-7-sonnet-20250219-v1:0'
AWS_ACCESS_KEY_ID=***PROPER_VALUE
AWS_SECRET_ACCESS_KEY=***PROPER_VALUE
AWS_SESSION_TOKEN=***PROPER_VALUE

Regardless there is no way to debug it further using cli (debug/verbose).
I've run wireshark to get more information and I am getting the following handshake errors:

453 HTTP error on Client Hello (SNI=api.anthropic.com) using TLSv1.3 protocol.
457 HTTP error on Client Hello (SNI=console.anthropic.com) using TLSv1.3 protocol.
457 HTTP error on Client Hello (SNI=statsig.anthropic.com) using TLSv1.3 protocol.

View original on GitHub ↗

51 Comments

sid374 contributor · 1 year ago

@mikelibg were you able to OAuth successfully to your Anthropic Console account?

bcherny collaborator · 1 year ago

Closing for inactivity. Feel free to re-open when you have a chance to respond.

mikelibg · 1 year ago

Hi @sid374 , sorry for the late reply, was not available during these days.
Yes, I was able to connect to the Anthropic Console account with no issue.
It seems to happen only with the cli.

@bcherny Can you please re-open the issue (it seems I dont have an option to do it), I am available from now on.

KyonXuu · 1 year ago

I also have this problem, how can you get this work?

Hi @sid374 , sorry for the late reply, was not available during these days. Yes, I was able to connect to the Anthropic Console account with no issue. It seems to happen only with the cli. @bcherny Can you please re-open the issue (it seems I dont have an option to do it), I am available from now on.
sid374 contributor · 1 year ago

@mikelibg @Xuyaoyan could you please check if you're able to make a request to the anthropic API from your machines?

curl -X POST https://api.anthropic.com/v1/messages \
  -H "x-api-key: my_api_key" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-3-7-sonnet-20250219",
    "max_tokens": 20000,
    "temperature": 1,
    "system": "answer briefly",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "hello claude!"
          }
        ]
      }
    ]
  }'

Use any non-claude code API key from your console accounts.

mikelibg · 1 year ago

Got proper response, have enough credits, while still getting the describe error when running claude in terminal for claude code.

{
  "id": "msg_01Htot89TUejJk4SGz7gAe5g",
  "type": "message",
  "role": "assistant",
  "model": "claude-3-7-sonnet-20250219",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I assist you today?"
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 12,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 12
  }
}

Moreover, I enabled AWS bedrock setup with proper aws token and flags, but still when running the claude command, wireshark shows I am going directly to anthropic instead of aws.

P.S.
I am able to properly work with AWS bedrock claude on the same laptop (macbook m1 pro) with lightllm and using direct requests as you mentioned.

mikelibg · 1 year ago

@sid374 can you please advise what else can be done to understand why the call to api.claude is rejected or why it is even going to this api, while I defined bedrock api to be used with claude code?

rdeetz · 1 year ago

I am having the same issue.
I can authenticate via OAuth to claude.ai.
When I connect directly to the API (using the curl command above), I get the successful response.
When I run claude from the command line (after freshly installing v0.2.72) I get

│ ✻ Welcome to Claude Code research preview! │
╰────────────────────────────────────────────╯

 Unable to connect to Anthropic services

 Failed to connect to console.anthropic.com: Request failed with status code 403

 Please check your internet connection and network settings.

 Note: Claude Code might not be available in your country. Check supported countries at https://anthropic.com/supported-countries

I am in the United States, not using any kind of VPN or proxy.

Please advise what can be done to diagnose or provide additional information.

sam-briggs-depop · 1 year ago

I'm also getting this issue in the United Kingdom.

  • I can authenticate via OAuth to claude.ai
  • When I connect directly to the API (using the curl command above), I get the successful response.
  • When I run claude from the command line I get the 403 error

rdeetz · 1 year ago
I am having the same issue. I can authenticate via OAuth to claude.ai. When I connect directly to the API (using the curl command above), I get the successful response. When I run claude from the command line (after freshly installing v0.2.72) I get `` │ ✻ Welcome to Claude Code research preview! │ ╰────────────────────────────────────────────╯ Unable to connect to Anthropic services Failed to connect to console.anthropic.com: Request failed with status code 403 Please check your internet connection and network settings. Note: Claude Code might not be available in your country. Check supported countries at https://anthropic.com/supported-countries `` I am in the United States, not using any kind of VPN or proxy. Please advise what can be done to diagnose or provide additional information.

lol I tried again this morning (changed nothing, just re-ran claude) and it worked 🤷🏻

mikelibg · 1 year ago

Resolved my problem by updating the openssl from 3.4.0 to 3.4.1 on my mac.
So if you have my use case run the following in terminal:

brew update
# upgrading all formulas
brew upgrade
# or upgrading specifically openssl
brew install openssl
ndiezel0 · 1 year ago

Updating to openssl 3.4.1 didn't solve it for me. Still searching for ways to resolve it. My particular problem is Failed to connect to console.anthropic.com: Request failed with status code 403.

@mikelibg how did you arrive at your solution? Did you find any logs?

ZhengRui · 1 year ago

I am using openssl 3.4.1 and having the same issue.

sergeanton · 1 year ago

For whom may be insterested :
Same issue. I am on windows but with docker installed.
After uninstall Docker, it works fine !

ebeckner-looptech · 1 year ago

I typically run a few instances of Claude Code concurrently, after restarting one of my instances I noticed this issue for the first time (01MAY2025). Oddly enough, my remaining instances were still coding away. Once all instances were restarted, the error became a total block.

I access Claude Code via wsl Ubuntu in the states.

I tried all of these things, which did not work:

  • Resetting DNS configuration
  • Enabling/disabling VPN
  • Removing auth.json
  • Restarting wsl
  • uninstalling/reinstalling Claude Code
  • uninstalling/reinstalling Ubuntu

sergeanton's recommendation led me to update Docker Desktop, after updating, everything is working fine.

I noticed that anthropic opened up authentication via Max, and Docker updated recently. Curious if these are related to my interdiction.

vrishbhanusingh · 1 year ago

I have the same issue. I am running claude desktop with a max plan.
I am on windows but accessing claude through wsl in the terminal.
This is the error message that I'm getting:
╭────────────────────────────────────────────╮
✻ Welcome to Claude Code research preview! │
╰────────────────────────────────────────────╯

Unable to connect to Anthropic services

Failed to connect to api.anthropic.com:

Please check your internet connection and network settings.

Note: Claude Code might not be available in your country. Check supported countries at
https://anthropic.com/supported-countries

How do I fix this, want to try claude code asap.

SEDIDEL · 1 year ago

Hi everyone!

I was having the same issue (WSL on Windows), and I was able to fix it by running sudo apt-get update, sudo apt-get upgrade -y, and then restarting.

Hope this helps!

notnullxyz · 1 year ago

I am experiencing this issue, as well. Out of the blue. No amount of upgrading on my windows or Linux boxens are solving it. Local install, no docker. Issue persists. I cleared configurations, but it remains the same.

jvirico · 1 year ago

Same here, I use it in several terminals with two accounts, and after /login it suddenly started to happen. None of the above solutions seem to work in my case.

Folyd · 1 year ago

Same for me, it suddenly said unable to connect to Anthropic services.

╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview!        │
╰───────────────────────────────────────────────────╯

 Unable to connect to Anthropic services

 Failed to connect to console.anthropic.com: Request failed with status code 403

 Please check your internet connection and network settings.

 Note: Claude Code might not be available in your country. Check supported countries at
 https://anthropic.com/supported-countries
Folyd · 1 year ago

I guess Anthropic blocked all cloud virtual machine IPs? I tested it not working any more for Microsoft Azure.

$ curl https://ipinfo.io
{
  "ip": "1*.8*.56.23*",
  "city": "San Jose",
  "region": "California",
  "country": "US",
  "loc": "37.3394,-121.8950",
  "org": "AS8075 Microsoft Corporation",
  "postal": "95025",
  "timezone": "America/Los_Angeles",
  "readme": "https://ipinfo.io/missingauth"

$ curl https://ipinfo.io
{
  "ip": "2*.17*.127.6*",
  "city": "Phoenix",
  "region": "Arizona",
  "country": "US",
  "loc": "33.4484,-112.0740",
  "org": "AS8075 Microsoft Corporation",
  "postal": "85001",
  "timezone": "America/Phoenix",
  "readme": "https://ipinfo.io/missingauth"
notnullxyz · 1 year ago

Carpet bombing entire nets apparently. https://github.com/anthropics/claude-code/issues/984
@Folyd - You're on Azure, and we see the same on DO.

jvirico · 1 year ago

Not working either from my Azure VM in West Europe region.

printcotton · 1 year ago

I'm on Digital Ocean - exactly the same issue, started about six hours ago. Very frustrating.

jvirico · 1 year ago

Solved for me in Azure VMs.

printcotton · 1 year ago

And now for me in DO.

notnullxyz · 1 year ago

Solved in DO.

Yuutakasan · 1 year ago

I was using WLS2 on CentOS until yesterday, and it was working then, but when I tried to get the latest version to use the MAX account, it stopped working.

$ curl -I https://console.anthropic.com/healthz --max-time 10
HTTP/2 403
date: Sun, 11 May 2025 11:14:24 GMT
content-type: text/html; charset=UTF-8
content-length: 6980
accept-ch: Sec-CH-UA-Bitness, Sec-CH-UA-Arch, Sec-CH-UA-Full-Version, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Platform, Sec-CH-UA, UA-Bitness, UA-Arch, UA-Full-Version, UA-Mobile, UA-Model, UA-Platform-Version, UA-Platform, UA
cf-mitigated: challenge
critical-ch: Sec-CH-UA-Bitness, Sec-CH-UA-Arch, Sec-CH-UA-Full-Version, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Platform, Sec-CH-UA, UA-Bitness, UA-Arch, UA-Full-Version, UA-Mobile, UA-Model, UA-Platform-Version, UA-Platform, UA
cross-origin-embedder-policy: require-corp
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
permissions-policy: accelerometer=(),autoplay=(),browsing-topics=(),camera=(),clipboard-read=(),clipboard-write=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
referrer-policy: same-origin
server-timing: chlray;desc="93e140a66df280c3"
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
set-cookie: __cf_bm=PYtN_RENAxL4xx0_HEZ3Jmihdt7K.a7mjL47i75gD8M-1746962064-1.0.1.1-PJs9PMut0cmMEOpJUK7Px3P1tF5xZN4O8.PIygw9zFLenj68NH7pVRbgG_eP5QombRBVOvtW1JB35Y2vKRk48RO_RA55Fmh57OPzlTxI5Lw; path=/; expires=Sun, 11-May-25 11:44:24 GMT; domain=.console.anthropic.com; HttpOnly; Secure; SameSite=None
server: cloudflare
cf-ray: 93e140a66df280c3-NRT
alt-svc: h3=":443"; ma=86400

kheasley · 1 year ago

In WSL, the solution for me was to set the networking mode to mirrored.

In Powershell:

wsl --shutdown
notepad "$env:USERPROFILE\.wslconfig"

And in this file:

[wsl2]
networkingMode=mirrored

The issue was that WSL was essentially acting like a network proxy.

Yuutakasan · 1 year ago

I was able to resolve the issue by following the steps below to set up Cloudflare WARP on Linux:

Install and enable Cloudflare WARP client

curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list && \
sudo apt update && \
sudo apt install -y cloudflare-warp && \
sudo warp-cli register && \
sudo warp-cli connect

These commands will:

  1. Import the Cloudflare GPG key
  2. Add the Cloudflare APT repository
  3. Update the package list
  4. Install the Cloudflare WARP client
  5. Register the client
  6. Connect to the WARP network

Let me know if you’re using a different Linux distribution so I can adjust the steps accordingly.

samueljpearce · 1 year ago

I tried using different networking modes or Cloudflare WARP as suggested and managed to get further but kept running into the same issue or getaddrinfo EAI_AGAIN errors. Eventually discovered disabling ipv6 as per https://github.com/anthropics/claude-code/issues/532#issuecomment-2859143133 fixed my issue without needing Cloudflare WARP.

NixuK · 1 year ago
I tried using different networking modes or Cloudflare WARP as suggested and managed to get further but kept running into the same issue or getaddrinfo EAI_AGAIN errors. Eventually discovered disabling ipv6 as per #532 (comment) fixed my issue without needing Cloudflare WARP.

Can confirm. Using WSL Ubuntu 24.04 disabling ipv6 instantly fixed the "Unable to connect" issue with Claude Code.

JobaDiniz · 1 year ago

I'm on Windows WSL, and the same issue. When I kill Docker Desktop process, it works! _Say whaaat?_

aldinokemal · 1 year ago

!Image

I'm still experiencing this issue today while using WSL, with no VPN and a stable internet connection. I can access the Claude API and browser, so I think there's a problem with the CLI and the error messages aren't clear.

____
[Update]
I fixed this by configuring .wslconfig.
Step:

  1. wsl --shutdown
  2. notepad "$env:USERPROFILE\.wslconfig"
  3. Paste code above:
[wsl2]
networkingMode=mirrored
kernelCommandLine=ipv6.disable=1
jediwarpraptor · 1 year ago

Ping and Curl to api.anthropic.com works fine from WSL2. I've tried several of the "fixes" above and none of them have worked. WSL2 - Ubuntu22.04.5 - Windows 10

ByteJuggler · 1 year ago

Ran into this. Disabling IPv6 works. From within wsl, before starting Claude, do:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

(It used to work fine. No idea why it stopped, but it started when I forced a logout e.g. /logout.)

DaviPolita · 1 year ago

I'm working behind a corporate proxy, and our network team has already allowlisted the api.anthropic.com endpoint. However, I was still unable to connect.

Setting NODE_TLS_REJECT_UNAUTHORIZED=0 works but its not ideal, we are looking for a better solution.

NODE_TLS_REJECT_UNAUTHORIZED=0 claude

ThoughtPhotography · 1 year ago

Similar here.
It was working fine in WSL, but I wanted to uninstall/reinstall to make sure I had the newest version to use my Pro account..
That ended up being a mess. I eventually got it installed again and it kept having this error.

Running curl in the same WSL window gave me a proper reply and DNS check was fine.

I've tried a bunch of things, but nothing worked.
networkingMode=mirrored isn't supported on my windows version (10)

I updated to the newest version of WSL (from 2.4.x) and that appears to have fixed it.
Worth a try.

t-ishitsuka · 1 year ago

I'm running into the same issue.
Disabling IPv6 is blocking communication between Docker and my Windows host machine, and it's cause an another problem.

majorco · 1 year ago

The problem has not been solved yet
<img width="979" alt="Image" src="https://github.com/user-attachments/assets/a4f6503f-d6b2-479b-9132-9925c1830545" />

jishnu-mohan · 1 year ago

I get this error when Docker desktop is open and it works when Docker desktop is closed.

StefenMonica · 1 year ago
The problem has not been solved yet <img alt="Image" width="979" src="https://private-user-images.githubusercontent.com/53105087/456868108-a4f6503f-d6b2-479b-9132-9925c1830545.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTAzMzUzMzMsIm5iZiI6MTc1MDMzNTAzMywicGF0aCI6Ii81MzEwNTA4Ny80NTY4NjgxMDgtYTRmNjUwM2YtZDZiMi00NzliLTkxMzItOTkyNWMxODMwNTQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNjE5VDEyMTAzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc4N2EwNjgxZjNlNmNhYmRlOTY3Y2EwYTBiNDMyNGY3NjBjYzUyMWI2NDdhY2Q4OTRlNTNjMzg3ZDlhNzI0YjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.YbC-0vloqhKplppOx_zA3TrV2dDv7n8lBpsHKkJ6aLk">

Can you please tell me how you solved this problem? thanks.

horrace · 1 year ago

Going to WSL settings (in start menu) and changing network mode to mirrored worked for me

StefenMonica · 1 year ago
Going to WSL settings (in start menu) and changing network mode to mirrored worked for me

Okay, I think this is a good approach. I’ll give it a try. Thanks!

SamPeng87 · 1 year ago

I may have found where the problem lies, but I cannot fix it. This should be resolved by anthropics.

I have worked for 15 years and have never seen anyone put Cloudflare's human verification on an API endpoint.

How to verify that?

curl -v "https://console.anthropic.com/v1/oauth/hello" \
     -H 'Accept: application/json' \
     -H 'User-Agent: claude-cli/1.0.27 (external, cli)' \
     -H 'Accept-Encoding: gzip, compress, deflate, br'

You can find Cloudflare waiting for people to pass human verification.

This is very ridiculous. In home environments like apartments, offices, etc., it is very likely to trigger Cloudflare human verification. Why does the API endpoint use Cloudflare human verification?

hassancs91 · 1 year ago

for me it was the the Network Adapter Disabled. "Hyper-V WSL Adapter"
enabled with:
Enable-NetAdapter -Name "vEthernet (WSL (Hyper-V firewall))" -Confirm:$false

and got my connection back

bjgrosart · 1 year ago

Make sure you have WSL2

wsl --set-version Ubuntu 2

t-ishitsuka · 1 year ago
I get this error when Docker desktop is open and it works when Docker desktop is closed.

I obtained a stable connection by taking the following actions.

・Disable Docker Desktop
・Start Docker CE on WSL2 Ubunts
・Disable IPv6

daniel-akinyemi · 11 months ago

Its a telementry issue. You can bypass the check using:

DISABLE_TELEMETRY=1 claude
Hope this helps.

bcherny collaborator · 10 months ago

We've fixed a number of related issues over the last few months. This issue should be happening much less often, and when it does happen, error outputs should help you debug the issue. If errors are still not useful, run claude --debug for more debug output. Please open a new issue if you are still running into this.

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.