anthropics / anthropics/claude-code

[BUG] ECONNRESET on all requests — curl, node https, and node fetch all succeed to api.anthropic.com on the same machine

オープン
#91,970 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
api:anthropic area:networking bug duplicate platform:macos
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

Claude Code v2.1.260 fails with ECONNRESET on every launch. curl, Node's https module, and Node's fetch all reach api.anthropic.com successfully from the same machine at the same time, so the network path is healthy and the failure appears specific to Claude Code's bundled HTTP client.

The Claude desktop app's Code tab fails identically with "Connection problem", while regular Claude chat works normally.

Error on every launch:

Welcome to Claude Code v2.1.260
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ECONNRESET

claude --debug produces no additional output beyond the above.

Evidence the network is fine:
- curl -v https://api.anthropic.com → HTTP/2 404, TLS 1.3 handshake completes, valid cert
- node -e "require('https').get('https://api.anthropic.com', r => console.log(r.statusCode))" → 404
- node -e "fetch('https://api.anthropic.com').then(r => console.log(r.status))" → 404

Ruled out:
- Fails on both home Wi-Fi and cellular hotspot
- No VPN — NordVPN removed, systemextensionsctl list → 0 extensions after reboot
- scutil --nc list empty
- No proxy — env | grep -i proxy empty, scutil --proxy shows defaults only
- No ANTHROPIC_* env vars
- Fresh config — rm -rf ~/.claude ~/.claude.json, still fails
- Clean npm reinstall after removing native install at ~/.local/share/claude
- Fails on both 2.1.251 and 2.1.260
- IPv6 disabled at the interface, no change
- DNS switched to

### What Should Happen?

Claude Code should connect to api.anthropic.com and start a session.

### Error Messages/Logs

```shell
$ claude
Welcome to Claude Code v2.1.260

Unable to connect to Anthropic services

Failed to connect to api.anthropic.com: ECONNRESET

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

$ curl -v https://api.anthropic.com
< HTTP/2 404
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* Server certificate: CN=api.anthropic.com, issuer Google Trust Services
* server: cloudflare

$ node -e "require('https').get('https://api.anthropic.com', r => console.log('Status:', r.statusCode))"
Status: 404

$ node -e "fetch('https://api.anthropic.com').then(r => console.log('Status:', r.status))"
Status: 404
```

### Steps to Reproduce

1. Run `claude` in Terminal on macOS
2. It fails immediately with "Failed to connect to api.anthropic.com: ECONNRESET"
3. Run `curl -v https://api.anthropic.com` from the same shell — returns HTTP 404 successfully
4.

### Claude Model

None

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

2.1.260 (Claude Code)

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

claude doctor output:

Running: native (2.1.260)
Platform: darwin-arm64
Config install method: native
Search: OK (bundled)
Auto-updates: enabled
No installation issues found.

Node: v24.14.1
Plan: Pro
Installed via: sudo npm install -g @anthropic-ai/claude-code (which claude → /usr/local/bin/claude)

Additional note: IPv6 to api.anthropic.com resets during the TLS handshake
(curl -6 → "Recv failure: Connection reset by peer"), while IPv4 succeeds.
However, disabling IPv6 at the interface did not resolve the issue, and curl,
node https, and node fetch all fall back to IPv4 without problems.

Also tested: the Claude desktop app's Code tab fails identically with
"Connection problem". Regular Claude chat works normally on the same machine
at the same time.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reproducing the failure with the `claude` entry point on macOS, then compare its connection behavior with the reported `curl`, Node `https`, and Node `fetch` commands. The issue is done when Claude Code starts a session against api.anthropic.com without ECONNRESET and the regression is covered by an appropriate test.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
macos, node.js
領域
api, networking
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。