CLI freezes when reading file content over SSH pipe
Description
Claude Code freezes when executing SSH commands that read file content, while metadata commands over the same SSH connection work fine.
Environment
- Claude Code version: 2.1.29
- OS: Kubuntu 24.04 (Linux 6.17.0-12-generic)
- Terminal: WezTerm
- Shell: bash
- SSH target: TrueNAS Scale (Debian-based), accessed via
ssh nas.local
Steps to Reproduce
- Have an SSH target with a text file (e.g., a log file with rsync progress output)
- Run metadata commands - these work:
``bash``
ssh host 'stat /path/to/file' # works
ssh host 'ls -la /path/to/file' # works
ssh host 'uptime' # works
ssh host 'top -bn1 | head -15' # works
ssh host 'zfs list' # works
- Run content-reading commands - these freeze:
``bash``
ssh host 'tail -20 /path/to/file' # freezes
ssh host 'tail -10 /path/to/file | cat -v' # freezes
ssh host 'cat /path/to/file | head -5' # freezes
Observed Behaviour
- The CLI shows the spinning status (e.g., "✽ Bloviating… (thought for 3s)")
- The thought timer stops incrementing and stays frozen
- No input can be entered - the CLI is completely unresponsive
- Must close and resume the session to recover
- Reproducible across multiple sessions
Expected Behaviour
SSH commands that read file content should complete and return output, or timeout gracefully.
Workaround
Using scp to copy the file locally, then reading locally works fine:
scp host:/path/to/file /tmp/file # works
cat /tmp/file # works
Additional Context
- Initially suspected target host load (heavy rsync running), but freezes occurred even when target load average was 0.20
- The file in question contained rsync progress output with escape sequences (
\r, progress bars), but piping throughcat -vto sanitise output didn't help - The freeze appears related to streaming/piping file content over SSH specifically, not SSH connectivity itself (metadata commands work instantly)
scpof the same file works fine, suggesting the issue is with how Claude Code handles streamed SSH output rather than the SSH connection or file itself
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗