Fix Claude Code v2.1.120 Regression: --resume/--continue Crash ('g9H is not a function') and 'sandbox required but unavailable' on macOS, Linux, and Windows
Claude Code v2.1.120 (auto-updated April 24-25, 2026) introduced a critical regression that broke all --resume and --continue functionality. Two distinct crash modes were reported: (1) REPL mount crash with 'g9H is not a function. (In g9H(K), g9H is undefined)' — caused by an undefined onSessionRestored callback in the REPL component, and (2) 'sandbox required but unavailable' error on resume even when sandbox.enabled=false in settings — caused by the resume code path consulting the sandbox gate before honoring user settings. Both were confirmed cross-platform (macOS, Linux, Windows). Anthropic acknowledged the regression within hours and rolled back the auto-update pointer from v2.1.120 to v2.1.119. Users on v2.1.120 can work around by rolling back to v2.1.119 or using /resume inside a fresh interactive session. The fix shipped in v2.1.121+ (auto-updater restores working version).
Symptoms
- Running 'claude --resume <session-id>' or 'claude --continue' crashes immediately with: 'ERROR g9H is not a function. (In g9H(K), g9H is undefined)' on macOS/Linux
- Running 'claude --resume' or 'claude --continue' fails with: 'Error: sandbox required but unavailable: sandbox.failIfUnavailable is set — refusing to start without a working sandbox' even when sandbox.enabled=false in settings.json
- Fresh sessions ('claude' without --resume/--continue) work normally — only session restoration is affected
- Print mode ('claude -p --resume <id>') works fine — only interactive REPL mount is affected
- Auto-updater silently upgrades from v2.1.119 to v2.1.120, breaking existing workflow without user action
Error signatures
g9H is not a function
onSessionRestored is undefined
sandbox required but unavailable
sandbox.failIfUnavailable is set — refusing to start without a working sandbox
cli.js:9251:5663
Possible causes
- REPL mount regression (g9H crash): In v2.1.120, the REPL component Ub8 received initialMessages via useMemo but the onSessionRestored callback (g9H) was undefined when the component mounted with existing session data. The minified bundle analysis shows: 'let { onSessionRestored: g9H } = FXK({ enabled: S, ... })' where S is hardcoded false, causing FXK to skip populating g9H. When the useEffect hook calls g9H(K) on mount with non-empty messages, it throws TypeError
- Sandbox gate regression (sandbox error): In v2.1.120, the resume code path evaluates isSandboxRequired() before honoring the user's sandbox.enabled=false setting. The gating logic itself (isSandboxRequired, isSandboxingEnabled) was unchanged from v2.1.119, but the ORDER of evaluation changed — the sandbox unavailability check now fires before the user-configured opt-out is consulted on the resume path specifically
- Both regressions share the same trigger: any code path that restores a prior session in interactive mode (--resume, --continue, -c) enters a code path that was broken in v2.1.120's minified bundle. Fresh sessions and print-mode sessions bypass the broken code
- Root cause: v2.1.120 was pushed to the auto-update channel despite containing two distinct regressions in the session-restoration code path. The version was NOT removed from npm but the auto-update pointer was rolled back to v2.1.119 within hours
Solutions
Wait for auto-updater to roll back (no manual action needed)
Anthropic rolled back the auto-update pointer from v2.1.120 to v2.1.119 within hours of the regression report. The auto-updater (which runs periodically) will automatically replace v2.1.120 with the rollback target on next check. Users who were auto-updated to v2.1.120 will be auto-downgraded.
- Step 1: Verify you are on the broken version: `claude --version` → expect '2.1.120'
- Step 2: Wait for the auto-updater cycle (typically runs every few hours)
- Step 3: Check version again: `claude --version` → expect it has reverted to v2.1.119 or upgraded to v2.1.121+
- Step 4: If still on 2.1.120 after 6+ hours, use Solution 1 (manual rollback)
Commands
claude --version
# Wait for auto-update cycle, then:
claude --version
claude --resume <session-id> 2>&1; echo exit=$?
Risks
- Auto-updater timing varies — may take hours depending on when the update check fires
- If you previously disabled auto-update (claude update disable), this solution will not work — use Solution 1 instead
Verification
- Step 1: Run `claude --version` → expect: version is NOT '2.1.120' (should be 2.1.119 or 2.1.121+)
- Step 2: Run `claude --resume <session-id> 2>&1; echo exit=$?` → expect: session resumes normally, exit code 0, no 'g9H is not a function' or 'sandbox required' in stderr
- Step 3: If still failing after 6+ hours, auto-updater may not have run — switch to Solution 1
Use /resume from inside a fresh interactive session (no rollback needed)
The REPL-internal /resume command uses a different code path than --resume/--continue CLI flags. Starting a fresh session and using /resume from the TUI bypasses the broken CLI flag code path entirely. This is the fastest workaround that requires no version changes.
- Step 1: Start a fresh session with no flags: `claude`
- Step 2: At the Claude prompt, type `/resume` and press Enter
- Step 3: Select the desired session from the interactive picker (arrow keys + Enter)
- Step 4: The session restores without hitting the broken onSessionRestored callback in the --resume flag path
Commands
claude
/resume
Risks
- Requires an extra step (starting a fresh session first) compared to direct --resume
- May not work for headless/automated workflows that rely on --resume via CLI flags in scripts or CI pipelines
Verification
- Step 1: Run `claude` (fresh session, no flags) → expect: normal Claude Code prompt appears without crash
- Step 2: Type `/resume` and select a session from the picker → expect: session restores with conversation history intact
- Step 3: Verify session state by checking prior messages: type 'summarize our previous conversation' → expect: Claude references prior context from the restored session
Roll back to v2.1.119 (recommended immediate fix)
Replace the v2.1.120 binary with v2.1.119. The auto-updater should handle this automatically within hours of the pointer rollback, but manual rollback provides immediate relief.
- Step 1: Check current version with `claude --version` to confirm you are on the broken v2.1.120
- Step 2: Check if v2.1.119 is still cached locally: `ls ~/.local/share/claude/versions/`
- Step 3: If v2.1.119 is present, replace the symlink: `ln -sf ~/.local/share/claude/versions/2.1.119 ~/.local/bin/claude`
- Step 4: If v2.1.119 is not present, install it from npm: `npm install -g @anthropic-ai/claude-code@2.1.119`
- Step 5: Prevent auto-update back to broken version temporarily: `claude update disable` (re-enable after confirming fix)
- Step 6: Verify fix by resuming a session: `claude --resume <session-id>`
Commands
claude --version
ls ~/.local/share/claude/versions/
ln -sf ~/.local/share/claude/versions/2.1.119 ~/.local/bin/claude
npm install -g @anthropic-ai/claude-code@2.1.119
npm view @anthropic-ai/claude-code@2.1.119 version 2>&1; echo exit=$?
claude update disable
claude --resume <session-id> 2>&1; echo exit=$?
Risks
- npm v2.1.120 still exists on the registry — 'npm install -g @anthropic-ai/claude-code' without version pin may reinstall the broken version. Always pin with @2.1.119 or @2.1.121+
- Auto-updater may re-upgrade before the pointer rollback propagates (typically takes minutes to hours). Run `claude update disable` to prevent this temporarily
Verification
- Step 1: Run `claude --version` → expect: '2.1.119' (NOT '2.1.120'). If version is still 2.1.120, the symlink or npm install did not take effect — re-check the paths
- Step 2: Verify npm registry has v2.1.119: `npm view @anthropic-ai/claude-code@2.1.119 version 2>&1; echo exit=$?` → expect stdout: '2.1.119', exit code 0. If exit code is non-zero, the version is not available — try v2.1.121 instead
- Step 3: Run `claude --resume <known-good-session-id> 2>&1; echo exit=$?` → expect: session resumes without 'g9H is not a function' or 'sandbox required' error, exit code 0
- Step 4: Run `claude --continue 2>&1 | head -5` → expect: no crash, normal Claude Code prompt appears
Agent JSON
Canonical machine-readable representation of this issue:
{
"issue_id": "b13804f9-cb53-42d0-9689-777eed3ab929",
"slug": "fix-claude-code-v2-1-120-regression-resume-continue-crash-g9h-is-not-a-function-and-sandbox-required-but-unavailable-on--uxt979",
"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-and-sandbox-required-but-unavailable-on--uxt979"
}