Session UI freeze when command outputs exceed ~5MB (git status on large node_modules)
Bug Description
Session became completely unresponsive/frozen after git status returned ~5.1 million characters of output. The terminal UI locked up, scrolling became impossible, and the session had to be abandoned.
Environment
| Component | Version |
|-----------|---------|
| Claude Code | 2.1.9 |
| macOS | 26.3 (Build 25D5087f) |
| Node.js | v25.2.1 |
| Terminal | macOS Terminal.app |
Session Details
- Session ID:
c3c43c76-74f0-4557-87e1-8c997e78f517 - Session file size: 22,034,493 bytes (22MB)
- Session lines: 1,892 JSONL entries
- Duration: Session ended 2026-01-16T13:04:11.814Z
Root Cause
Three JSON lines in the session exceeded 5MB each due to git operations on a repo with many deleted node_modules/.vite/deps_temp_* files:
| Line # | Size | Command |
|--------|------|---------|
| 1410 | 5.2MB | git status --short |
| 1420 | 5.2MB | git reset HEAD ... web/node_modules/... |
| 1435 | 5.2MB | Similar git operation |
The stdout field in these entries contained 5,127,215+ characters.
Steps to Reproduce
- Have a project with a
web/directory containingnode_modules/ - Have many deleted/modified files in
node_modules/.vite/deps_temp_*(hundreds of files) tracked by git - Claude Code runs
git status --shortor any git command that lists these files (e.g., autonomously before a commit) - The massive output freezes the UI
Expected Behavior
- Large outputs should be truncated before being stored/rendered
- Session should remain responsive regardless of command output size
- User should be able to scroll and interact
Actual Behavior
- UI completely froze
- Could not scroll up or down
- Could not type or interact
- Had to force-quit/abandon session
- Session JSONL file grew to 22MB with individual lines over 5MB
Workaround
Add node_modules/ to .gitignore and run git rm -r --cached node_modules/ to prevent git from tracking these files.
Additional Context
The session was doing normal development work (SQL queries, Python scripts, API calls). The freeze specifically occurred when Claude autonomously ran git commands to check status before a potential commit. This is a common Claude Code behavior that users don't directly control.
Suggested Fix
- Enforce output truncation before storing in session JSONL, not just in display
- Add safeguards for commands known to produce large output (git status, find, ls -R, etc.)
- Consider streaming/chunking large outputs rather than buffering entirely
- Add a circuit breaker that prevents individual JSONL entries from exceeding a reasonable size (e.g., 100KB)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗