RangeError: Maximum call stack size exceeded when running in tmux with large outputs
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code crashes with RangeError: Maximum call stack size exceeded when running inside tmux and receiving large outputs (tables, long streaming responses). The crash does not occur when running in a regular terminal outside tmux.
Environment
- Claude Code Version: 2.1.17
- OS: macOS Darwin 24.5.0
- Terminal: tmux inside Terminal.app / iTerm2
Stack Trace
RangeError: Maximum call stack size exceeded
Exception in PromiseRejectCallback:
file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:686
(Full trace available on request — it shows recursive calls in text rendering/wrapping functions)
Steps to Reproduce
- Start a tmux session
- Launch Claude Code inside tmux
- Ask Claude to generate a large output (e.g., markdown table with 20+ rows, or run a tool that produces verbose output)
- CLI crashes with stack overflow
Key observation: The same prompts work fine when Claude Code runs outside tmux.
What Should Happen?
Claude Code should render large outputs without crashing, regardless of whether it's running inside tmux or a regular terminal.
Suspected Cause
Based on related issues (#9157, #14860, #1495, #9935), this appears to be related to:
- Terminal width detection behaving differently in tmux
- Text wrapping recursion (
endOfWORD/noRfunctions) not hitting base case - Possibly compounded by tmux's high scroll event rate (#9935 reports 4,000-6,700 events/sec)
Workarounds
- Running Claude Code outside tmux (not ideal for workflows requiring multiple sessions)
- Avoiding large outputs
- Using wider tmux panes
- Frequent
/clearbetween heavy operations
Related Issues
- #9157 —
endOfWORD()recursion with long outputs (closed, but bug persists) - #14860 —
noRrecursion in terminal rendering (closed as duplicate) - #9935 — Excessive scroll events in tmux
- #1495 — Rendering glitches with tmux resolution changes
Additional Context
This significantly impacts workflows that require running multiple Claude Code sessions in tmux (e.g., coordinating agents, parallel tasks). The crash loses all conversation context.
Claude Model
Claude Opus 4.5
Is this a regression?
No, but related issues were auto-closed without fix
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
tmux
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗