[BUG] Unable to connect Anthropic services

Status Fixed / completed
Maintainer reply None cached
Activity 6 comments · opened Jun 1, 2025 · closed Jun 1, 2025

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

  1. Follow Getting started from Guide
  2. 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 ``

View original on GitHub ↗

6 Comments

laxytt · 1 year ago

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

knoel99 · 1 year ago

I am experiencing the same issue but with WSL Ubuntu 22.04, and disabling ipv6 didn't work:

$ lsb_release -d
Description:    Ubuntu 22.04.3 LTS

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

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

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

$ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /home               │
╰───────────────────────────────────────────────────╯


> hello
  ⎿  API Error (Connection error.) · Retrying in 1 seconds… (attempt 1/10)
    ⎿  TypeError (fetch failed)
  ⎿  API Error (Connection error.) · Retrying in 1 seconds… (attempt 2/10)
    ⎿  TypeError (fetch failed)

* Transmuting… (1s · ↑ 0 tokens · esc to interrupt)

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ >                                                                                                                                                                                                                                     │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts



Total cost:            $0.0000
Total duration (API):  0s
Total duration (wall): 5.1s
Total code changes:    0 lines added, 0 lines removed
Tokens:                0 input, 0 output, 0 cache read, 0 cache write
shrey16 · 1 year ago
I am experiencing the same issue but with WSL Ubuntu 22.04, and disabling ipv6 didn't work: `` $ lsb_release -d Description: Ubuntu 22.04.3 LTS $ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.all.disable_ipv6 = 1 $sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6 = 1 $ sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 net.ipv6.conf.lo.disable_ipv6 = 1 $ claude ╭───────────────────────────────────────────────────╮ │ ✻ Welcome to Claude Code! │ │ │ │ /help for help, /status for your current setup │ │ │ │ cwd: /home │ ╰───────────────────────────────────────────────────╯ > hello ⎿ API Error (Connection error.) · Retrying in 1 seconds… (attempt 1/10) ⎿ TypeError (fetch failed) ⎿ API Error (Connection error.) · Retrying in 1 seconds… (attempt 2/10) ⎿ TypeError (fetch failed) * Transmuting… (1s · ↑ 0 tokens · esc to interrupt) ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ > │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ? for shortcuts Total cost: $0.0000 Total duration (API): 0s Total duration (wall): 5.1s Total code changes: 0 lines added, 0 lines removed Tokens: 0 input, 0 output, 0 cache read, 0 cache write ``

You should restart the wsl instance.

knoel99 · 1 year ago

Thank you @shrey16 . It happens time to time and I can't reproduce the error consistently. It's on the company PC.

nichsedge · 1 year ago

I'm using Ubuntu and Cloudflare WARP is activated. After running warp-cli disconnect, it was successful.

github-actions[bot] · 1 year 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.