[BUG] Claude Code Freezes on Continuous/Streaming Output (Serial Ports, Long-Running Processes)
[BUG] Claude Code Freezes on Continuous/Streaming Output (Serial Ports, Long-Running Processes)
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?
Claude Code immediately freezes when rendering continuous/unbuffered stream output, specifically from:
- Serial ports (
cat /dev/tty.usbmodem*) - Long-running processes with continuous output
- Any unbuffered stream without discrete termination
Steps to Reproduce
Minimal reproduction:
- Start fresh Claude Code session
- Run:
cat /dev/tty.usbmodem21401(or any serial port) - Immediate freeze - terminal completely unresponsive
- Must force-kill Claude Code
Test script provided:
# Clone the repo and run:
cd ~/claude-code
./test_stream_freeze.sh continuous # Will freeze immediately
See test_stream_freeze.sh and FREEZE_BUG_REPRODUCTION.md in the repo for full test suite and analysis.
What Should Happen?
Expected behavior:
- Stream output should render in real-time
- Should have timeout mechanism (e.g., 5 seconds)
- Should not deadlock on unbuffered streams
- Should remain responsive even with continuous output
Actual behavior:
- Complete freeze after starting stream
- No timeout mechanism
- Terminal becomes unresponsive
- Must force-kill Claude Code process
Confirmed Facts
✅ Happens in fresh sessions (not memory accumulation)
✅ Immediate freeze (< 1 second after starting stream)
✅ Reproducible with serial ports
✅ Workaround exists: Redirect to file first (timeout 5 cat /dev/tty.* > file && cat file)
Root Cause Analysis
Hypothesis:
- Claude Code's stream parser tries to buffer continuous output
- Parser waits for stream termination or line boundaries
- With continuous streams, neither occurs
- Parser/renderer enters deadlock waiting for completion
- UI thread becomes unresponsive
Why file redirection works:
timeout 5 cat /dev/tty.usbmodem* > /tmp/out.txt
cat /tmp/out.txt # Works - discrete, bounded output
File redirection provides discrete, complete output rather than continuous stream.
Claude Model
Sonnet (default)
Is this a regression?
Unknown - may have existed since serial port support was added
Last Working Version
_N/A - appears to have never worked for continuous streams_
Claude Code Version
1.0.113 (VSCode Extension)
Platform
Anthropic API
Operating System
macOS (Darwin 25.1.0)
Terminal/Shell
zsh + VS Code integrated terminal
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗