[BUG] API Error (Request timed out) in Remote SSH Dev Container on Linux Host
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.17 (Claude Code)
- Operating System: Ubuntu 24.04
- Terminal: Wezterm
Bug Description
The Claude CLI consistently fails with API Error (Request timed out.) when used inside a dev container hosted on a remote Linux machine (Ubuntu 24.04). The connection is established via the VS Code Remote-SSH extension. The issue appears after one or two successful API calls, making the CLI unusable for subsequent requests. This behavior is specific to the remote Linux environment and is not reproducible when the same dev container is run locally on Docker Desktop for macOS.
Steps to Reproduce
- On a local machine, use VS Code with the Remote-SSH extension to connect to a Linux host (Ubuntu 24.04).
- On the Linux host, clone the repository:
git clone https://github.com/kenfdev/study-claude-code.git - In VS Code, open the cloned folder using the "Open Folder in Container" command, which utilizes the
.devcontainerconfiguration in the repository. - Once the dev container is built and running, open a terminal and start with
claude --dangerously-skip-permissions - Give Claude Code instructions and start a task
Expected Behavior
Claude Code should execute successfully and return responses from the API
Actual Behavior
The first one or two tasks succeed. However, subsequent commands fail, displaying the following error message and retry attempts:
API Error (Request timed out.) · Retrying in 1 seconds… (attempt 1/10)
The command ultimately fails after all retry attempts are exhausted.
Additional Context
Troubleshooting Information:
- Host Environment: The remote host is running Ubuntu 24.04.
- Firewall & Proxy: I have confirmed that the Linux host is not running a local firewall (
ufwis inactive) and is not configured to use a proxy. - Local Mac Comparison: The issue is not reproducible when running the exact same dev container configuration on Docker Desktop for Mac. All commands succeed without timeouts.
- Debug Logs: Running with
ANTHROPIC_LOG=debug DEBUG=1shows the request being sent but provides no specific error before the timeout.
Log Snippet of a Failing Request(I don't think this information is useful though):
JSON
[log_1a57d1] sending request {
"method": "post",
"url": "https://api.anthropic.com/v1/messages?beta=true",
"options": {
"method": "post",
"path": "/v1/messages?beta=true",
"body": {
"model": "claude-sonnet-4-20250514",
"messages": "[Array]",
"temperature": 1,
"system": "[Array]",
"tools": "[Array]",
"tool_choice": null,
"metadata": "[Object]",
"max_tokens": 21333,
"thinking": "[Object]"
},
"timeout": 60000,
"stream": false
},
"headers": {
"accept": "application/json",
"anthropic-beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14",
"anthropic-dangerous-direct-browser-access": "true",
"anthropic-version": "2023-06-01",
"authorization": "***",
"content-type": "application/json",
"user-agent": "claude-cli/1.0.17 (external, cli)",
"x-app": "cli",
"x-stainless-arch": "x64"
}
}
Perhaps the following Issue may be related, but not completely https://github.com/anthropics/claude-code/issues/1536
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗