[BUG] Terminal.app crashes during display wake/reconfiguration with fullscreen renderer (TTLogicalScreen NSRangeException)

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Aug 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and did not find this exact crash signature.
  • [x] This is a single bug report.
  • [x] I am using the latest Claude Code release.

What's Wrong?

Apple Terminal.app intermittently crashes while Claude Code is running with the fullscreen/alternate-screen renderer enabled (CLAUDE_CODE_NO_FLICKER=1). Normal active use is generally stable. The strongest correlation is leaving the session open while the display turns off or the Mac is locked, then waking/unlocking it.

I observed three Terminal.app crashes on the same day. Two occurred about 150 ms after Terminal received display-wake and display-reconfiguration notifications. The third occurred shortly after relaunch during a redraw, with the same internal exception signature.

The process that crashes is Terminal.app, not the Claude Code process. I am reporting this here because:

  • the crash happens with Claude Code's fullscreen renderer and virtualized scrollback active;
  • switching Claude Code back to the default/inline renderer is an effective mitigation; and
  • two Ghostty sessions running the same Claude Code version and renderer at the same time remained stable.

What Should Happen?

Claude Code should redraw cleanly after display sleep, lock-screen wake, or display reconfiguration without causing the host terminal to terminate. If Apple Terminal.app cannot safely support this rendering path, Claude Code should detect it and use the default/inline renderer, or otherwise reset its rendering state before redrawing.

Error Messages/Logs

Sanitized excerpts from the macOS unified log (local time, UTC+08:00):

2026-08-01 08:39:12.102  Terminal  kCGSDisplayDidWake
2026-08-01 08:39:12.109  Terminal  kCGSDisplayWillReconfigure
2026-08-01 08:39:12.259  Terminal  -[TTLogicalScreen expandUnicharOffsetCacheToLine:]: Line 87 out of bounds (87)

2026-08-01 08:41:06.673  Terminal  FAULT: NSRangeException
2026-08-01 08:41:06.673  Terminal  -[TTLogicalScreen expandUnicharOffsetCacheToLine:]: Line 159 out of bounds (97)

2026-08-01 15:04:28.565  Terminal  kCGSDisplayDidWake
2026-08-01 15:04:28.569  Terminal  kCGSDisplayWillReconfigure
2026-08-01 15:04:28.681  Terminal  invalid display identifier <private>
2026-08-01 15:04:28.708  Terminal  -[TTLogicalScreen expandUnicharOffsetCacheToLine:]: Line 161 out of bounds (147)

All three .ips crash reports have the same high-level signature:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Termination:     SIGNAL 5, Trace/BPT trap
Faulting thread: 0, com.apple.main-thread
Top frame:       +[NSApplication _crashOnException:]
Underlying exception: NSRangeException
Terminal method: -[TTLogicalScreen expandUnicharOffsetCacheToLine:]

CoreFoundation  __exceptionPreprocess
libobjc         objc_exception_throw
CoreFoundation  +[NSException exceptionWithName:reason:userInfo:]
Terminal        [private Terminal frames]
AppKit          _NSViewDrawRect
AppKit          -[NSViewBackingLayer display]
QuartzCore      CA::Layer::display_if_needed

The crash reports show only Apple/system images loaded into Terminal.app; I found no evidence of third-party code injection. Full sanitized .ips reports are available if useful.

Steps to Reproduce

This is intermittent, but the following sequence reproduced it multiple times:

  1. Open Apple Terminal.app.
  2. Enable Claude Code's fullscreen renderer with /tui fullscreen or CLAUDE_CODE_NO_FLICKER=1.
  3. Start Claude Code and leave a session open with enough output/scrollback to exercise the TUI.
  4. Lock the Mac or allow the display to turn off while the session remains open.
  5. Wake the display and unlock the Mac.
  6. Terminal.app may crash immediately during redraw/display reconfiguration.
  7. Relaunching Terminal and resuming use may produce another crash with the same TTLogicalScreen out-of-bounds exception.

Claude Model

Not sure / multiple models. This appears to be independent of the selected model.

Is this a regression?

I don't know. The default/inline renderer is stable; I have not established a specific last working Claude Code version for fullscreen mode.

Last Working Version

Not established. The old/default renderer is the working configuration.

Claude Code Version

2.1.220 (Claude Code), native installer.

Platform

Other / not relevant to the terminal rendering path.

Operating System

macOS 26.5.2 (25F84), arm64.

Terminal/Shell

Apple Terminal.app 2.15 (470.2), zsh.

Additional Information

Comparison and workaround
  • Two Ghostty sessions were running Claude Code 2.1.220 with the same CLAUDE_CODE_NO_FLICKER=1 environment at the time; neither crashed.
  • Switching Apple Terminal.app sessions to /tui default avoids the problematic rendering path.
  • The persistent workaround is:

``sh
unset CLAUDE_CODE_NO_FLICKER
export CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1
``

Hypothesis (not proven)

The immediate exception is in Apple Terminal.app's private TTLogicalScreen implementation. The timing suggests that display wake/reconfiguration invalidates or changes screen geometry while Claude Code's fullscreen renderer is issuing incremental redraw/control sequences against virtualized scrollback. Terminal then appears to draw using a stale line-to-Unicode-offset cache and raises NSRangeException on an out-of-bounds line index.

This could be an Apple Terminal bug exposed by Claude Code rather than a memory-safety bug in Claude Code itself. A Claude-side mitigation could be to default Apple Terminal.app to the inline renderer, or force a clean renderer/state reset after terminal resize, display wake, or geometry changes.

Related reports
  • #78650 — Claude sessions crash on macOS wake from deep sleep (different process/signature, same wake boundary)
  • #76065 — external-display TUI stays blank until continuous resize/full redraw
  • #77615 — overlapping/garbled TUI text and stale cells on macOS
  • #80131 — CLAUDE_CODE_NO_FLICKER=1 fails in iTerm2 but works in Ghostty
  • #72455 — Apple Terminal.app 470.2 fullscreen-renderer compatibility issue; /tui default fixes it

I have intentionally omitted prompt contents, command history, user paths, process IDs, and hardware identifiers from these excerpts.

View original on GitHub ↗