[BUG] Claude Code hangs for ~5 minutes then resets connection when tool call has very large parameters

Resolved 💬 3 comments Opened Mar 27, 2026 by mackong Closed Mar 30, 2026

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

  1. Create a file hang.txt with the following content:

```
Create world_data.py containing all of the following hardcoded data:

  1. 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)

  1. Information for every province / state within each country
  2. Latitude and longitude coordinates for the world's top 1,000 largest cities
  3. All data written as Python dictionary / list constants

All content must be written into a single file: world_data.py
```

  1. Run claude and use the content of hang.txt as the prompt (or reference it with @hang.txt)
  2. Claude will attempt to generate a very large world_data.py file via the Write tool
  3. 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗