`claude --resume` crashes with "g9H is not a function" in 2.1.120 (REPL onSessionRestored hook returns undefined when disabled)

Resolved 💬 2 comments Opened Apr 25, 2026 by txgo Closed Apr 25, 2026

Summary

claude --resume crashes immediately on session restore with TypeError: g9H is not a function in 2.1.120 (latest) on macOS arm64 (Homebrew cask).

ERROR  g9H is not a function. (In 'g9H(K)', 'g9H' is undefined)
 /$bunfs/root/src/entrypoints/cli.js:9251:5663

Repro

  1. Have any prior session that can be resumed (i.e. ~/.claude/projects/... has session JSONLs).
  2. claude --resume → pick any session.
  3. The REPL throws as soon as initialMessages is non-empty.

claude (no --resume) works fine. The crash is specific to the resume / continue path that pre-populates the REPL with messages.

Root cause (from the bundled cli.js)

In the Ub8 REPL component:

let { onBeforeQuery: F9H, onTurnComplete: ZLH, onSessionRestored: g9H, render: aM_, ownsInput: LLH }
  = FXK({ enabled: S, setMessages: F7, setInputValue: R5, setToolJSX: o9, resultDedupState: uF.current });

S is hardcoded to false:

let S = s_.useMemo(() => !1, []);

So FXK is called with enabled: false and does not return onSessionRestored, leaving g9H === undefined.

Then a mount-time useEffect unconditionally calls it whenever there are initial messages (the resume path):

s_.useEffect(() => {
  if (K && K.length > 0) {
    HP_(K, K8()),
    hY8({ abortController: new AbortController, taskRegistry: YH }),
    tC8(K),
    UQ(K),
    sYH.current.current = xz_(K, g8),
    g9H(K);   // ← TypeError when S === false
  }
}, []);

So whenever the new "remote/standalone" feature is disabled (its current default state), every resume crashes.

Suggested fix

Either guard the call (g9H?.(K)) or have FXK return a no-op onSessionRestored when enabled is false. The ?. call is the smaller patch and matches the pattern used elsewhere in this file for hook-returned callbacks.

Workaround

Length-preserving byte patch on the bun-compiled binary works (,g9H(K)},g9H&&K}, two occurrences), then ad-hoc resign with original entitlements + --options runtime. Documented in detail in case it helps anyone else hitting this on 2.1.120 before a real fix ships.

Environment

  • Claude Code 2.1.120 (Homebrew claude-code@latest, bun-compiled single-file Mach-O)
  • macOS Darwin 25.0.0, arm64
  • Confirmed against the brew binary at /opt/homebrew/Caskroom/claude-code@latest/2.1.120/claude

View original on GitHub ↗

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