[BUG] claude -c crashes with FKH is not a function when resuming a session with prior messages
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Running claude -c (continue) on any project that has an existing session with non-empty message history immediately crashes with:
ERROR FKH is not a function. (In 'FKH(K)', 'FKH' is undefined)
B:/~BUN/root/src/entrypoints/cli.js:9273:5663
The error fires before the UI renders, so the session is unusable. claude (fresh session, no -c) works fine.
Environment
- OS: Windows 11 Home (10.0.26200)
- Shell: PowerShell
- Claude Code: <please fill in claude --version output>
- Working directory: a project with existing .jsonl session files under %USERPROFILE%\.claude\projects\<project>\
Reproduction
- In any project that already has at least one session with messages, run claude -c
- Observe the crash above; the session id printed in the "Resume this session with: claude --resume " hint is the session being loaded
- Reproduces 100% on that project; running plain claude (new session) succeeds
Root Cause Analysis (from the bundled cli.js)
The crash is in the REPL component (function hCq) and stems from a destructuring mismatch, not from corrupt session data.
- S is hard-coded to false:
S = s8.useMemo(() => !1, [])
- XJ7({ enabled: S, ... }) is called with enabled: false, which causes the early-return / no-op branch and does not return onSessionRestored:
let { onBeforeQuery: UKH, onTurnComplete: LVH, onSessionRestored: FKH,
render: iW8, ownsInput: ZVH } = XJ7({ enabled: S, ... })
- So FKH === undefined.
- The mount effect calls FKH(K) unconditionally whenever the initial messages array K is non-empty:
s8.useEffect(() => {
if (K && K.length > 0)
sW8(K, Kq()), GMq(...), BIq(K), pc(K),
oMH.current.current = I38(K, Fq),
FKH(K) // ← crashes here when enabled:false
}, [])
So any claude -c (or --resume) into a session that has prior messages triggers the crash, because FKH is only defined when XJ7 is enabled, but the effect that calls it doesn't gate on
enabled.
Suggested Fix
Either:
- Make the XJ7({ enabled: false }) branch return a no-op onSessionRestored, or
- Guard the call site: FKH?.(K) / if (FKH) FKH(K).
Workaround
Start a fresh session with plain claude (no -c / --resume) — works because the K.length > 0 branch isn't taken.
Stack Trace
- <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:9273:5663)
- PI (B:/~BUN/root/src/entrypoints/cli.js:512:63749)
- Fw (B:/~BUN/root/src/entrypoints/cli.js:512:76948)
- P5 (B:/~BUN/root/src/entrypoints/cli.js:512:76827)
- Fw (B:/~BUN/root/src/entrypoints/cli.js:512:77745)
- P5 (B:/~BUN/root/src/entrypoints/cli.js:512:76827)
- Fw (B:/~BUN/root/src/entrypoints/cli.js:512:76926)
- P5 (B:/~BUN/root/src/entrypoints/cli.js:512:76827)
- Fw (B:/~BUN/root/src/entrypoints/cli.js:512:77745)
- P5 (B:/~BUN/root/src/entrypoints/cli.js:512:76827)
- async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:19019:11089)
---
What Should Happen?
claude -c (and claude --resume <id>) should successfully restore the previous session and render the REPL, regardless of whether the session has prior messages. Specifically:
- The mount effect that runs when initial messages K are present must not throw — onSessionRestored (FKH in the bundle) should always be safely callable.
- When XJ7 is invoked with enabled: false, it should still return a no-op onSessionRestored (matching the shape it returns when enabled), or the call site should guard with FKH?.(K).
- End-user impact: continuing a previous session should drop me into the loaded conversation history with no error overlay, exactly as claude (new session) does today.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Open a terminal (PowerShell on Windows 11 in my case) and cd into any project directory that already has at least one Claude Code session with prior messages — i.e. a non-empty
*.jsonl under %USERPROFILE%\.claude\projects\<project-slug>\.
- In my case: cd D:\parker\etton-erp (slug D--parker-etton-erp, contains a 1.4 MB session jsonl with substantial history).
- Run:
claude -c
- (equivalent: claude --resume <session-id> against the same session.)
- Observe the immediate crash before the REPL renders:
ERROR FKH is not a function. (In 'FKH(K)', 'FKH' is undefined)
B:/~BUN/root/src/entrypoints/cli.js:9273:5663
- The CLI prints a "Resume this session with: claude --resume " hint and exits.
- Confirm it is not data corruption: run plain claude (no -c) in the same directory — a fresh session starts cleanly with no error.
- Confirm it is reproducible on the same session: re-run claude -c or claude --resume <id> against that session — crashes 100% of the time.
Expected: step 3 loads the prior conversation and shows the REPL.
Actual: step 3 throws FKH is not a function and never renders.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.120 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗