KBCodeKB
Unverified

Fix Claude Code v2.1.120 Regression: --resume/--continue Crash ('g9H is not a function')

Claude Code v2.1.120 (April 24, 2026) introduced a regression that crashes EVERY interactive session resume with 'ERROR g9H is not a function. (In g9H(K), g9H is undefined)'. The crash occurs in the REPL component's mount effect: when `FXK({enabled: false, ...})` is called, the returned object lacks `onSessionRestored`, but the mount effect unconditionally invokes `g9H(K)` whenever the resumed session has messages. Anthropic staff member wolffiex acknowledged the issue within hours, rolled back the auto-update pointer from v2.1.120 to v2.1.119, and closed the issue as completed. IMPORTANT: v2.1.120 STILL EXISTS on npm (April 2026–present) — the fix was auto-updater-side only, not a new npm release. Users who install via npm without version pinning may still get the broken version. The workaround is to use print mode (`claude -p --resume <id> '...'`) or pin to v2.1.119 / v2.1.121+. Latest Claude Code as of June 2026 is v2.1.177.

Symptoms

  • Running `claude -r <session-id>` or `claude --resume <session-id>` crashes immediately with 'ERROR g9H is not a function'
  • Error references minified bundle line: '/$bunfs/root/src/entrypoints/cli.js:9251:5663'
  • Crash occurs on EVERY interactive resume of a non-empty session — no sessions can be resumed interactively
  • Print mode (`claude -p --resume <id> '...'`) works fine against the same session file — confirms session data is intact, bug is in REPL mount path only
  • Reproduces with and without `--channels` plugin flags — plugins are not the trigger
  • Adjacent error: if `g9H` crash is bypassed (empty session), a different mount effect fires with 'Error: sandbox required but unavailable'

Error signatures

g9H is not a function
g9H is undefined
In 'g9H(K)', 'g9H' is undefined
/$bunfs/root/src/entrypoints/cli.js:9251:5663
sandbox required but unavailable
sandbox.failIfUnavailable is set

Possible causes

  • The REPL component's mount effect (`useEffect`) unconditionally calls `g9H(K)` whenever the resumed session has messages. However, `g9H` is destructured from the return value of `FXK({enabled: S, ...})`. When `S` (the `enabled` flag) is hardcoded to `false` via `useMemo(() => false, [])`, `FXK` returns an object that does NOT include `onSessionRestored`. Destructuring yields `undefined`, and the subsequent call `g9H(K)` throws a TypeError.
  • The regression was introduced in v2.1.120 (published April 24, 2026). The previous version v2.1.119 (April 23, 2026) does not have this bug. The issue was likely introduced by a refactoring that added the `enabled` flag to `FXK` without guarding the destructured callback for the `enabled: false` branch.
  • The fix was an auto-update pointer rollback (v2.1.120 → v2.1.119), NOT a new npm release. The broken v2.1.120 still exists on the npm registry. Users who bypass the auto-updater or install via npm without version constraints may still encounter this bug.
  • The adjacent sandbox error occurs when `g9H` is bypassed (e.g., by truncating the session so `initialMessages` is empty). A different mount effect checks `sandbox.failIfUnavailable` which defaults to `true` even when not explicitly set in any settings file.

Solutions

Start a New Session and Reference the Broken Session's Content

risk: lowgithubpublished

If you cannot downgrade and print mode is insufficient, start a new interactive session. Use print mode to extract the conversation summary from the broken session, then paste it as context in the new session. All file changes made during the broken session are already on disk — only the conversational context is lost.

  1. Extract summary from broken session: `claude -p --resume <old-id> 'List all files modified and the current task state'`.
  2. Start a new session: `claude`.
  3. Paste the summary as your first message: 'Continuing from previous session. Here is the context: <paste summary>.'
  4. Continue working. All code changes from the previous session are already applied to the filesystem.
  5. Optional: run `git diff` or `git status` in the new session to confirm all file changes are present.

Commands

claude -p --resume <old-id> 'List all modified files and task state'
claude
git status
git diff

Risks

  • Conversational context is partially lost — the AI won't know the exact reasoning chain from the previous session.
  • If the previous session included multi-step plans in the todo panel, those will need to be manually recreated.

Verification

  • Step 1: Run `claude -p --resume <old-id> 'What was I working on?' 2>&1 | head -20` → expect a coherent summary of the session state.
  • Step 2: Run `git status` → expect to see all file changes from the previous session.
  • Step 3: Start a new `claude` session, paste the summary → expect Claude to understand the context and continue.
0 verified0 failed

Pin to v2.1.119 (Last Known Good) or Upgrade Past v2.1.120

risk: lowofficialpublished

The auto-update pointer was rolled back from v2.1.120 to v2.1.119 within hours of the regression being reported. If you installed v2.1.120 manually or via npm, pin to v2.1.119 explicitly or upgrade to v2.1.121+ (published April 27, 2026) which postdates the auto-update rollback. IMPORTANT: v2.1.120 STILL exists on npm and will be installed if you run `npm install -g @anthropic-ai/claude-code@2.1.120`.

  1. Check your current version: `claude --version` or `npm list -g @anthropic-ai/claude-code`.
  2. If you are on v2.1.120, downgrade to v2.1.119: `npm install -g @anthropic-ai/claude-code@2.1.119`.
  3. Alternatively, upgrade past v2.1.120: `npm install -g @anthropic-ai/claude-code@latest` (latest is v2.1.177 as of June 2026).
  4. Verify with `claude --version` that you are NOT on v2.1.120.
  5. If using the auto-updater (default), it should have already rolled you back to v2.1.119. Check with `claude --version`.

Commands

npm install -g @anthropic-ai/claude-code@2.1.119
npm view @anthropic-ai/claude-code@2.1.119 version
npm view @anthropic-ai/claude-code@2.1.120 version
claude --version

Risks

  • v2.1.119 is outdated (April 2026). You lose features and fixes from v2.1.121 through v2.1.177.
  • v2.1.120 STILL EXISTS on npm — do NOT accidentally install it. Always pin to a specific good version.
  • Auto-update mechanisms may silently upgrade you back to the latest version.

Verification

  • Step 1: Run `npm view @anthropic-ai/claude-code@2.1.120 version 2>&1; echo exit=$?` → expect stdout: '2.1.120', exit code 0. Confirms the broken version still exists on npm (pitfall #40 pattern).
  • Step 2: Run `npm view @anthropic-ai/claude-code@2.1.119 version 2>&1; echo exit=$?` → expect stdout: '2.1.119', exit code 0. Confirms the last-good version is available.
  • Step 3: Install v2.1.119: `npm install -g @anthropic-ai/claude-code@2.1.119` → expect no errors.
  • Step 4: Run `claude -r <any-session-id> 2>&1; echo exit=$?` → expect normal session resume without 'g9H is not a function' error.
  • Step 5 (alternative): Install latest: `npm install -g @anthropic-ai/claude-code@latest` → `claude --version` → expect version > 2.1.120 (NOT 2.1.120). Resume a session → expect no crash.
0 verified0 failed

Use Print Mode as Workaround (Preserves Session Access)

risk: lowgithubpublished

Print mode (`claude -p --resume <id> '...'`) does not mount the REPL, so the broken `g9H` effect never runs. This allows you to access and query the session while the bug is present. This is the fastest workaround if you just need to extract information or run a single query against the session.

  1. Identify your session ID — session IDs are displayed in `claude --resume` list or stored in `~/.claude/sessions/`.
  2. Run: `claude -p --resume <session-id> 'Summarize the current state of the project and what was being worked on'`.
  3. If you need to continue working, start a new interactive session and paste the summary from print mode as context.
  4. Alternatively, use print mode to extract the session transcript: `claude -p --resume <id> 'Output the full conversation transcript'`.

Commands

claude -p --resume <session-id> 'Summarize the project state'
claude --resume  # lists available sessions
ls ~/.claude/sessions/

Risks

  • Print mode is non-interactive — you cannot have a back-and-forth conversation. Each invocation is a single request.
  • Print mode may consume API tokens for the summary request.

Verification

  • Step 1: Run `claude --resume 2>&1` → expect list of session IDs. If 'g9H is not a function' crashes this listing, the bug is active.
  • Step 2: Run `claude -p --resume <id> 'Hello' 2>&1; echo exit=$?` → expect a response without 'g9H is not a function', exit code 0.
0 verified0 failed

Agent JSON

Canonical machine-readable representation of this issue:

{
  "issue_id": "3d8fdcc5-e57f-4f06-92ae-62bccbf320e7",
  "slug": "fix-claude-code-v2-1-120-regression-resume-continue-crash-g9h-is-not-a-function-mpqw67",
  "verification_status": "unverified",
  "canonical_json": "https://codekb.dev/v1/issues/fix-claude-code-v2-1-120-regression-resume-continue-crash-g9h-is-not-a-function-mpqw67"
}
← Back to all issuesPowered by CodeKB