claude-code - 💡(How to fix) Fix `claude --resume` crashes with "g9H is not a function" in 2.1.120 (REPL onSessionRestored hook returns undefined when disabled) [1 comments, 2 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#53195Fetched 2026-04-26 05:21:55
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5closed ×1commented ×1

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

Error Message

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

Root Cause

Root cause (from the bundled cli.js)

Fix Action

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.

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(() => !1, []);

---

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
  }
}, []);
RAW_BUFFERClick to expand / collapse

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

extent analysis

TL;DR

The most likely fix is to guard the call to g9H with g9H?.(K) to prevent the TypeError when S is false.

Guidance

  • The issue is caused by g9H being undefined when S is false, which is the default state.
  • To verify, check if the error occurs when claude --resume is run with a prior session.
  • A possible mitigation is to apply the suggested fix of guarding the call to g9H with g9H?.(K).
  • Alternatively, a workaround is to apply a length-preserving byte patch on the bun-compiled binary, as described in the issue.

Example

s_.useEffect(() => {
  if (K && K.length > 0) {
    // ...
    g9H?.(K); // Guard the call to g9H
  }
}, []);

Notes

The issue is specific to the claude --resume command and only occurs when S is false. The suggested fix and workaround are specific to this scenario.

Recommendation

Apply the workaround of guarding the call to g9H with g9H?.(K), as it is a smaller patch and matches the pattern used elsewhere in the file.

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 `claude --resume` crashes with "g9H is not a function" in 2.1.120 (REPL onSessionRestored hook returns undefined when disabled) [1 comments, 2 participants]