anthropics / anthropics/claude-code
[BUG] Pointless timeout prevents updates over slow internet connections
- 主要语言
- 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?
When trying to update Claude Code on a slow[^1] but otherwise functioning internet connection, the update will time out due to a pointless 10-minute timeout applied to the time it takes to download the binary.
### What Should Happen?
There shouldn't be a timeout on the download itself. So long as bytes are flowing, that means it will eventually manage to download the thing and there is no reason to abort the download just because it's slow. The only timeout should be for cases when there's no progress _at all_, which would suggest something is wrong.
### Error Messages/Logs
```shell
$ claude update
Current version: 2.1.237
Checking for updates to latest version...
Updating to 2.1.241...
Error: Failed to install native update
TelemetrySafeError: Download timed out: exceeded the total deadline
Try running "claude doctor" for diagnostics
```
### Steps to Reproduce
1. Be on a slightly outdated Claude Code version.
2. Have a sufficiently slow[^1] internet connection, i.e. much less than is required to download the new binary within 10 minutes.
3. Run `claude update`, thus starting the download.
4. Wait 10 minutes for the download to time out.
### Claude Model
Not sure / Multiple models
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.237
### Platform
Anthropic API
### Operating System
Ubuntu/Debian Linux
### Terminal/Shell
Other
### Additional Information
NOTE: I checked "I am using the latest version of Claude Code" despite being on a slightly older one (2.1.237), because I obviously can't test its **update** functionality if I'm on the latest version already! Given the lack of other issues about this, I'm just going to assume this hasn't been fixed in more recent versions either.
#### Workarounds
- Claude found out that setting the `CLAUDE_CODE_DOWNLOAD_DEADLINE_MS_FOR_TESTING` env var to a sufficiently large value (e.g. `3600000` = one hour, enough time to download the 2.1.241 340 MB binary over a ~0.75 Mbit/s connection) lets the update proceed.
- As the name implies, this is clearly a testing/debug feature and not meant for end users, can be removed at any time etc. Hence no replacement for actually removing the timeout.
#### Related issues and why this isn't a duplicate of them
- https://github.com/anthropics/claude-code/issues/86970
- Same underlying issue but they frame it from the perspective of not wasting metered bandwidth and are also asking for more features like resume functionality or whatever. Whereas I'm just asking for the pointless time limit to be removed.
- https://github.com/anthropics/claude-code/issues/88834
- Similar issue for the installer. I haven't looked into it but given that there is such a timeout on the update download, it's not unreasonable to believe that the installer has it too. And the original installation was in fact timing out for me as well until I switched to a faster internet connection, so that's probably it.
- https://github.com/anthropics/claude-code/issues/78435
- Kind of the same underlying issue; the connection speeds shown in the screenshot are above the threshold determined in this issue, but see [my comment](https://github.com/anthropics/claude-code/issues/78435#issuecomment-5399506107) for how this might come about anyway.
- However, that ticket is framed in terms of constant retries. Whereas I don't care if it keeps retrying e.g. if the connection is in fact flaky, all I care about in this ticket is that it finishes the download on slow-but-not-flaky connections.
- https://github.com/anthropics/claude-code/issues/79942
- Is about multiple simultaneous downloads similar to #78435, asks for a lock which is already implemented but buggy; see [my comment](https://github.com/anthropics/claude-code/issues/79942#issuecomment-5400496677) for details.
- https://github.com/anthropics/claude-code/issues/66751
- Is about the same underlying phenomenon and mentions the timeout, but again has all kinds of other issues and feature requests mixed together. Still probably incorrectly closed.
- https://github.com/anthropics/claude-code/issues/85046
- Same underlying issue, asks for different things as fixes.
### Footnotes
[^1]: The exact threshold depends on the current binary size: at version 2.1.241, the binary download was ~340 MB, so with the 10 minute timeout the minimum required bandwidth was ~558 KB/s ≈ 4.5 Mbit/s. The binary size has been reduced to ~75 MB in 2.1.243, so it's now lower. But the basic issue itself still exists.
贡献指南
这个仓库没有索引到贡献指南
调研方向
Start by tracing the `claude update` command and the native update download, using the reported `CLAUDE_CODE_DOWNLOAD_DEADLINE_MS_FOR_TESTING` setting as a clue to the timeout path. Reproduce with a deliberately slow connection and verify that downloads continue while bytes are flowing, while a connection with no progress still fails appropriately.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100