[BUG] React TUI crash: undefined is not an object (evaluating 'w.length') in hook dependency checker

Resolved 💬 3 comments Opened Feb 9, 2026 by Bmottomus Closed Feb 13, 2026

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?

Environment

  • Claude Code version: 2.1.37
  • OS: macOS 15.7.3 (Darwin 24.6.0, x86_64)
  • Runtime: Bun (/$bunfs/root/claude)

Description

Claude Code terminal UI crashed with an unrecoverable React rendering error. The terminal became unresponsive — only Ctrl+C
works. No interactive recovery possible.

Error

ERROR undefined is not an object (evaluating 'w.length')

Stack trace (deminified key frames)

n9 (hook deps comparison) /$bunfs/root/claude:685:20565
g3 (update effect) /$bunfs/root/claude:685:28719
r7 (useEffect) /$bunfs/root/claude:685:28873
TD (useSyncExternalStore) /$bunfs/root/claude:685:25085
<anonymous> /$bunfs/root/claude:191:9236
XA /$bunfs/root/claude:3623:4221
yE$ /$bunfs/root/claude:7325:12534
R9H /$bunfs/root/claude:7338:10259
L9 (renderWithHooks) /$bunfs/root/claude:685:20775
z4 (mountIndeterminate) /$bunfs/root/claude:685:39175

Root cause (likely)

A useSyncExternalStore hook received undefined as its previous dependencies array during re-render. The React reconciler's n9
function (which checks function n9(K,w){...w.length...}) dereferences w.length where w is undefined.

Steps to reproduce

  • Unable to deterministically reproduce. Crash occurred during an active session with multiple tool calls / subagents running.

Expected behavior

TUI should handle rendering errors gracefully without freezing the terminal.

What Should Happen?

TUI should handle rendering errors gracefully without freezing the terminal.

Error Messages/Logs

ERROR  undefined is not an object (evaluating 'w.length')

  Stack trace (deminified key frames)

  n9 (hook deps comparison)     /$bunfs/root/claude:685:20565
  g3 (update effect)            /$bunfs/root/claude:685:28719
  r7 (useEffect)                /$bunfs/root/claude:685:28873
  TD (useSyncExternalStore)     /$bunfs/root/claude:685:25085
  <anonymous>                   /$bunfs/root/claude:191:9236
  XA                            /$bunfs/root/claude:3623:4221
  yE$                           /$bunfs/root/claude:7325:12534
  R9H                           /$bunfs/root/claude:7338:10259
  L9 (renderWithHooks)          /$bunfs/root/claude:685:20775
  z4 (mountIndeterminate)       /$bunfs/root/claude:685:39175

Steps to Reproduce

Unable to deterministically reproduce. Crash occurred during an active session with multiple tool calls / subagents running.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

4.5

Claude Code Version

2.1.37

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗