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 个 reaction 已指派 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 摘要。