Reading files with very long lines crashes the terminal
Resolved 💬 3 comments Opened Jan 12, 2026 by kevin-allen Closed Jan 15, 2026
Description
Reading a log file containing a very long line (~5 million characters) causes Claude Code terminal to crash or hang.
Root Cause
tqdm progress bars use carriage return (\r) to overwrite the progress line in terminals. When output is redirected to a file (common on compute clusters), these \r characters don't create new lines—they just accumulate, creating a single massive line with all progress bar updates concatenated.
Example: A 6MB log file with only 18 lines, where line 13 was 5,434,081 characters (the accumulated progress bar).
Expected Behavior
Claude Code should handle files with extremely long lines gracefully:
- Truncate lines beyond a reasonable length
- Warn about unusually long lines
- Limit rendering to prevent terminal crashes
Workaround
Use shell tools to inspect such files safely:
# Check line lengths
awk '{print NR": length="length($0)}' file.log
# View truncated lines
cut -c1-200 file.log
Environment
- Claude Code CLI
- Linux
Reported by: Kevin
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗