claude-code - 💡(How to fix) Fix Crash on --resume/--continue after branching session history (Esc Esc): g9H is not a function [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#53174Fetched 2026-04-26 05:22:29
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
1
Timeline (top)
labeled ×4commented ×2

Error Message

 - <anonymous> (/$bunfs/root/src/entrypoints/cli.js:9251:5663)
 - WC (/$bunfs/root/src/entrypoints/cli.js:492:63749)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76948)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76926)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:77745)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76926)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)

Root Cause

From the minified source, g9H maps to onSessionRestored — a callback destructured from FXK() (appears to be a plugin/extension hook system). The crash occurs during REPL initialization when the session restore path calls g9H(K) (i.e., onSessionRestored(initialMessages)), but the function is undefined.

The relevant destructuring at the call site:

let {onBeforeQuery: F9H, onTurnComplete: ZLH, onSessionRestored: g9H, render: aM_, ownsInput: LLH} = FXK({enabled: S, ...})

The function is called during the initial useEffect:

s_.useEffect(() => {
    if (K && K.length > 0)
        HP_(K, K8()), ..., g9H(K)  // crashes here
}, []);

It seems like the FXK hook returns undefined for onSessionRestored when the session has a forked/branched history, possibly because the enabled flag (S) evaluates to false for branched sessions and the hook doesn't return a no-op fallback.

Code Example

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

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

---

- <anonymous> (/$bunfs/root/src/entrypoints/cli.js:9251:5663)
 - WC (/$bunfs/root/src/entrypoints/cli.js:492:63749)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76948)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76926)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:77745)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76926)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)

---

let {onBeforeQuery: F9H, onTurnComplete: ZLH, onSessionRestored: g9H, render: aM_, ownsInput: LLH} = FXK({enabled: S, ...})

---

s_.useEffect(() => {
    if (K && K.length > 0)
        HP_(K, K8()), ..., g9H(K)  // crashes here
}, []);
RAW_BUFFERClick to expand / collapse

Bug Description

When resuming a session that has been branched multiple times by going back in time (using Esc Esc to rewind), both --resume and --continue crash with an undefined function error.

Steps to Reproduce

  1. Start a Claude Code session
  2. Branch the conversation multiple times by pressing Esc Esc to go back in history
  3. Exit the session
  4. Attempt to resume with claude --dangerously-skip-permissions --resume or claude --dangerously-skip-permissions --continue

Error Output

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

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

Stack Trace

 - <anonymous> (/$bunfs/root/src/entrypoints/cli.js:9251:5663)
 - WC (/$bunfs/root/src/entrypoints/cli.js:492:63749)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76948)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76926)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:77745)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)
 - pj (/$bunfs/root/src/entrypoints/cli.js:492:76926)
 - fT (/$bunfs/root/src/entrypoints/cli.js:492:76827)

Analysis

From the minified source, g9H maps to onSessionRestored — a callback destructured from FXK() (appears to be a plugin/extension hook system). The crash occurs during REPL initialization when the session restore path calls g9H(K) (i.e., onSessionRestored(initialMessages)), but the function is undefined.

The relevant destructuring at the call site:

let {onBeforeQuery: F9H, onTurnComplete: ZLH, onSessionRestored: g9H, render: aM_, ownsInput: LLH} = FXK({enabled: S, ...})

The function is called during the initial useEffect:

s_.useEffect(() => {
    if (K && K.length > 0)
        HP_(K, K8()), ..., g9H(K)  // crashes here
}, []);

It seems like the FXK hook returns undefined for onSessionRestored when the session has a forked/branched history, possibly because the enabled flag (S) evaluates to false for branched sessions and the hook doesn't return a no-op fallback.

Environment

  • OS: macOS (Darwin 24.6.0)
  • Shell: zsh
  • Claude Code version: Latest as of 2026-04-25
  • Model: claude-opus-4-6 (1M context)

extent analysis

TL;DR

The issue can be fixed by ensuring the onSessionRestored function is properly defined and returned by the FXK hook, even for branched sessions.

Guidance

  • Investigate the FXK hook to determine why it returns undefined for onSessionRestored when the session has a forked/branched history.
  • Verify that the enabled flag (S) is correctly set for branched sessions and that the hook returns a no-op fallback when necessary.
  • Consider adding a default value or a fallback function for onSessionRestored to prevent the crash.
  • Review the useEffect hook to ensure it properly handles the case where g9H (or onSessionRestored) is undefined.

Example

let {onSessionRestored: g9H = () => {}} = FXK({enabled: S, ...})

This example sets a default value for onSessionRestored to an empty function, preventing the crash when FXK returns undefined.

Notes

The root cause of the issue seems to be related to the FXK hook and its behavior for branched sessions. Further investigation is needed to determine the exact cause and to find a robust solution.

Recommendation

Apply a workaround by adding a default value or a fallback function for onSessionRestored, as shown in the example above, to prevent the crash and allow the session to resume.

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 Crash on --resume/--continue after branching session history (Esc Esc): g9H is not a function [2 comments, 3 participants]