claude-code - 💡(How to fix) Fix Resume crashes with "g9H is not a function" in 2.1.120 (onSessionRestored undefined when REPL feature flag is off) [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53214Fetched 2026-04-26 05:21:27
View on GitHub
Comments
2
Participants
3
Timeline
13
Reactions
0
Timeline (top)
labeled ×6cross-referenced ×4commented ×2subscribed ×1

Error Message

ERROR g9H is not a function. (In 'g9H(K)', 'g9H' is undefined)

Root Cause

Root cause (from the minified bundle)

In cli.js around line 9250, the REPL component destructures from a hook call:

Fix Action

Workaround

Downgrade to 2.1.119:

npm install -g @anthropic-ai/[email protected]

Code Example

ERROR  g9H is not a function. (In 'g9H(K)', 'g9H' is undefined)

/$bunfs/root/src/entrypoints/cli.js:9251:5663

---

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

---

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

---

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
}, []);

---

npm install -g @anthropic-ai/claude-code@2.1.119
RAW_BUFFERClick to expand / collapse

Environment

  • Claude Code: @anthropic-ai/[email protected] (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/[email protected]

extent analysis

TL;DR

The most likely fix is to guard the call to g9H with an optional chaining operator (g9H?.(K)) to prevent the crash when resuming a conversation.

Guidance

  • Verify that the issue is resolved by resuming a conversation after applying the suggested fix.
  • Consider downgrading to version 2.1.119 as a temporary workaround if the fix is not immediately available.
  • Review the FXK function to ensure it always returns an onSessionRestored property, even when enabled is false, to prevent similar issues in the future.
  • Test the fix with different conversation scenarios to ensure it does not introduce any new issues.

Example

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);   // Guard the call to g9H with an optional chaining operator
}, []);

Notes

The suggested fix assumes that the g9H function is not essential when enabled is false. If this is not the case, an alternative solution may be required.

Recommendation

Apply the workaround by downgrading to version 2.1.119 until a permanent fix is available, as it is a simpler and more straightforward solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Resume crashes with "g9H is not a function" in 2.1.120 (onSessionRestored undefined when REPL feature flag is off) [2 comments, 3 participants]