claude-code - 💡(How to fix) Fix [BUG] claude -c crashes with FKH is not a function when resuming a session with prior messages [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#53768Fetched 2026-04-28 06:47:45
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Timeline (top)
labeled ×5commented ×2closed ×1

Error Message

ERROR FKH is not a function. (In 'FKH(K)', 'FKH' is undefined) The error fires before the UI renders, so the session is unusable. claude (fresh session, no -c) works fine.

  • 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

ERROR FKH is not a function. (In 'FKH(K)', 'FKH' is undefined) 4. Confirm it is not data corruption: run plain claude (no -c) in the same directory — a fresh session starts cleanly with no error.

Root Cause

Root Cause Analysis (from the bundled cli.js)

Fix Action

Fix / Workaround

Workaround

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. In any project that already has at least one session with messages, run claude -c
  2. Observe the crash above; the session id printed in the "Resume this session with: claude --resume " hint is the session being loaded
  3. 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.

  1. S is hard-coded to false:

S = s8.useMemo(() => !1, []) 2. 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, ... })

  1. So FKH === undefined.
  2. 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

  1. 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).
  2. Run: claude -c
  3. (equivalent: claude --resume <session-id> against the same session.)
  4. 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
  5. The CLI prints a "Resume this session with: claude --resume " hint and exits.
  6. Confirm it is not data corruption: run plain claude (no -c) in the same directory — a fresh session starts cleanly with no error.
  7. 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

extent analysis

TL;DR

The most likely fix is to guard the call site with FKH?.(K) or make the XJ7({ enabled: false }) branch return a no-op onSessionRestored.

Guidance

  • The issue is caused by FKH being undefined when XJ7 is called with enabled: false, and then trying to call FKH(K).
  • To fix this, you can either modify the XJ7 function to return a no-op onSessionRestored when enabled is false, or add a null check before calling FKH(K), such as FKH?.(K).
  • Verify the fix by running claude -c or claude --resume <id> against a session with prior messages and checking that the REPL renders without errors.
  • If the issue persists, try debugging the XJ7 function to ensure it returns the expected onSessionRestored function.

Example

// Before
let { onBeforeQuery: UKH, onTurnComplete: LVH, onSessionRestored: FKH, ... } = XJ7({ enabled: S, ... });
s8.useEffect(() => {
  if (K && K.length > 0)
    // ...
    FKH(K) // crashes when FKH is undefined
}, []);

// After
let { onBeforeQuery: UKH, onTurnComplete: LVH, onSessionRestored: FKH, ... } = XJ7({ enabled: S, ... });
s8.useEffect(() => {
  if (K && K.length > 0)
    // ...
    FKH?.(K) // add null check to prevent crash
}, []);

Notes

  • The issue is specific to the claude -c and claude --resume <id> commands

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 [BUG] claude -c crashes with FKH is not a function when resuming a session with prior messages [2 comments, 3 participants]