Resume crashes with "g9H is not a function" in 2.1.120 (onSessionRestored undefined when REPL feature flag is off)
Environment
- Claude Code:
@anthropic-ai/claude-code@2.1.120(npm global) - Platform: macOS (Darwin 25.2.0), arm64
- Shell: zsh
Symptom
Resuming any conversation immediately throws:
ERROR g9H is not a function. (In 'g9H(K)', 'g9H' is undefined)
/$bunfs/root/src/entrypoints/cli.js:9251:5663
This happens on every resume — fresh sessions are unaffected.
Root cause (from the minified bundle)
In cli.js around line 9250, the REPL component destructures from a hook call:
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(() => false, []);
When enabled: false, FXK returns an object that does not include onSessionRestored, so g9H is undefined.
But the resume effect calls it unconditionally whenever there are initial messages:
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); // ← crashes here when g9H is undefined
}, []);
K is initialMessages, which is non-empty exactly when the user is resuming a conversation — hence the crash on every resume.
Suggested fix
Either guard the call (g9H?.(K)), or have FXK always return an onSessionRestored (no-op when disabled), so the destructured value is callable.
Workaround
Downgrade to 2.1.119:
npm install -g @anthropic-ai/claude-code@2.1.119This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗