[BUG] Unable to connect Anthropic services
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.6 (Claude Code)
- Operating System: Windows 10 Pro - using ubuntu WSL 2 in terminal
- Terminal: WSL 2
Bug Description
After following the -Guide, at the very end when trying to run command claude
im getting:
╭──────────────────────────╮
│ ✻ Welcome to Claude Code │
╰──────────────────────────╯
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
Note I'm located in Poland, doesn't have any network issues, claude doctor says my npm is fine.
Steps to Reproduce
- Follow Getting started from Guide
- run 'claude' command
Expected Behavior
Claude opens as expected
Actual Behavior
Error is being shown
Additional Context
``ping api.anthropic.com Pinging api.anthropic.com [160.79.104.10] with 32 bytes of data: Reply from 160.79.104.10: bytes=32 time=11ms TTL=56 Reply from 160.79.104.10: bytes=32 time=11ms TTL=56 Reply from 160.79.104.10: bytes=32 time=11ms TTL=56 Ping statistics for 160.79.104.10: Packets: Sent = 3, Received = 3, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 11ms, Maximum = 11ms, Average = 11ms Control-C PS C:\Users\laxyt> nslookup api.anthropic.com Server: UnKnown Address: 192.168.100.1 Non-authoritative answer: Name: api.anthropic.com Addresses: 2607:6bc0::10 160.79.104.10 ``
6 Comments
I've managed to fix it thanks to comment in bug: https://github.com/anthropics/claude-code/issues/532#issuecomment-2859143133
zhil
last month
disabling ipv6 before using claude code works just fine for me.
I didnt completely disable it to prevent some possible weird issues with other soft, I just disable it when I want to use claude code with tailscale
command for Ubuntu 24
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
I am experiencing the same issue but with WSL Ubuntu 22.04, and disabling ipv6 didn't work:
You should restart the wsl instance.
Thank you @shrey16 . It happens time to time and I can't reproduce the error consistently. It's on the company PC.
I'm using Ubuntu and Cloudflare WARP is activated. After running
warp-cli disconnect, it was successful.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.