[BUG] Claude Code hangs for ~5 minutes then resets connection when tool call has very large parameters
Preflight Checklist
- [x] I have searched existing issues 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 a tool call requires very large parameters (e.g., writing a very large file), Claude Code hangs for approximately 5 minutes, then actively resets the network connection and re-initiates a new request. From the user's perspective, Claude Code appears to be frozen/stuck during this time.
This seems to be a timeout issue — when the model response includes a large tool call payload (such as writing a file with extensive content), the streaming response takes too long and triggers a network reset.
What Should Happen?
Claude Code should handle large tool call parameters gracefully without timing out. The streaming response should continue until complete, regardless of how large the tool call payload is. If a timeout is necessary, there should be a clear error message rather than silently resetting and retrying.
Error Messages/Logs
No explicit error messages are shown. Claude Code appears frozen for ~5 minutes, then silently resets the connection and starts a new request.
Steps to Reproduce
- Create a file
hang.txtwith the following content:
```
Create world_data.py containing all of the following hardcoded data:
- A complete information dictionary for every country in the world:
Country name (in both Chinese and English), ISO code, capital city, population, area, GDP, currency, language(s), timezone(s), phone country code, list of neighboring/bordering countries, major cities (top 10)
- Information for every province / state within each country
- Latitude and longitude coordinates for the world's top 1,000 largest cities
- All data written as Python dictionary / list constants
All content must be written into a single file: world_data.py
```
- Run
claudeand use the content ofhang.txtas the prompt (or reference it with@hang.txt) - Claude will attempt to generate a very large
world_data.pyfile via the Write tool - Observe that Claude Code hangs for ~5 minutes, then resets and retries
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.84 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
The root cause appears to be related to how Claude Code handles streaming responses that contain very large tool call parameters. When the model needs to write a massive file (e.g., a comprehensive world data dictionary), the tool call payload can be extremely large, and the current timeout/network handling doesn't account for this scenario.
This issue is reproducible with any prompt that causes Claude to generate a very large single-file output via tool calls.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗