[BUG] Unhandled promise rejection crash in Ink rendering layer with invalid terminal dimensions
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?
When running claude, it crashes immediately with an unhandled promise rejection. The error points to the Ink terminal UI layer failing during render.
## What I think is happening
Looking at the minified code in the stack trace, I can see references to ink-box, ink-text, yogaNode, and layout calculations. The RangeError: Array length must be a positive integer suggests the output buffer is being
created with an invalid size - probably because the terminal is reporting 0 or negative dimensions.
The crash happens in:
- Ink's reconciler (
onRender,unmount) - Yoga layout engine (null yoga nodes)
- Buffer allocation with bad dimensions
What Should Happen?
Instead of crashing with a cryptic minified stack trace, it would be nice if Claude Code:
- Checked terminal dimensions before starting the UI
- Showed a clear error like "Your terminal has invalid dimensions, please resize or check your terminal settings"
- Had proper error handling around the Ink render loop
Error Messages/Logs
❯ claude
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
RuntimeError: access to a null reference (evaluating 'Y$.apply(null,gI)')
at <anonymous> (/$bunfs/root/claude:702:6815)
at <anonymous> (/$bunfs/root/claude:702:30854)
RangeError: Array length must be a positive integer of safe magnitude.
at get (/$bunfs/root/claude:790:8127)
at onRender (/$bunfs/root/claude:811:6349)
at unmount (/$bunfs/root/claude:811:7674)
at emit (/$bunfs/root/claude:44:1608)
Steps to Reproduce
Not 100% sure, but likely running claude in a context where stty size returns 0 0 or the terminal doesn't report valid columns/rows."
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.51 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Terminal: alacritty
System: Arch Linux with Hyperland
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗