claude-code - 💡(How to fix) Fix [BUG] 2.1.120 interactive --resume crashes: `UKH is not a function` (RW4 stub missing onSessionRestored) [3 comments, 4 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#53180Fetched 2026-04-26 05:22:20
View on GitHub
Comments
3
Participants
4
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×5commented ×3cross-referenced ×1subscribed ×1

Claude Code 2.1.120 interactive --resume (and any flow that loads non-empty initialMessages) crashes immediately with:

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

Stack anchor: cli.js:9247:5663 (REPL QC6 mount effect).

Downgrading to 2.1.119 makes the same command work.

Error Message

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

Root Cause

Root cause (binary analysis)

Fix Action

Fix / Workaround

Workaround for affected users

Code Example

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

---

claude --resume
# pick any prior session whose JSONL has K.length > 0 messages

---

let { onBeforeQuery:FKH, onTurnComplete:vvH, onSessionRestored:UKH, render:sJ$, ownsInput:VvH }
  = RW4({ enabled:I, setMessages:F7, setInputValue:G_, setToolJSX:oK, resultDedupState:RF.current });

---

useEffect(() => {
  if (K && K.length > 0) {
    $L$(K, K6());
    yO6({...});
    eR6(K);
    Bc(K);
    tOH.current.current = u3$(K, U6);
    UKH(K);   // ← undefined when RW4 returns the disabled stub
  }
}, []);

---

function RW4(H){
  return {
    onBeforeQuery: async()=>!0,
    onTurnComplete: async()=>{},
    render: ()=>null
  }
}

---

# Pin to 2.1.119 (last known good)
ln -sfn ~/.local/share/claude/versions/2.1.119 ~/.local/bin/claude
# Optionally disable auto-update channel to prevent re-pull
RAW_BUFFERClick to expand / collapse

Summary

Claude Code 2.1.120 interactive --resume (and any flow that loads non-empty initialMessages) crashes immediately with:

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

Stack anchor: cli.js:9247:5663 (REPL QC6 mount effect).

Downgrading to 2.1.119 makes the same command work.

Environment

  • Claude Code: 2.1.120 (broken) · 2.1.119 (works)
  • Platform: Linux 6.12.73+deb13-amd64 (Debian 13)
  • Bun-bundled native build (/home/$USER/.local/share/claude/versions/2.1.120)
  • Plan: paid (auto-mode enabled · --enable-auto-mode)

Repro

claude --resume
# pick any prior session whose JSONL has K.length > 0 messages

Crash fires before any user input. Headless claude -p '<prompt>' is unaffected (different code path that doesn't preload initialMessages).

Root cause (binary analysis)

In 2.1.120's cli.js, the REPL component QC6 destructures onSessionRestored from the RW4 hook:

let { onBeforeQuery:FKH, onTurnComplete:vvH, onSessionRestored:UKH, render:sJ$, ownsInput:VvH }
  = RW4({ enabled:I, setMessages:F7, setInputValue:G_, setToolJSX:oK, resultDedupState:RF.current });

Then unconditionally calls UKH(K) in a mount effect when initialMessages is non-empty:

useEffect(() => {
  if (K && K.length > 0) {
    $L$(K, K6());
    yO6({...});
    eR6(K);
    Bc(K);
    tOH.current.current = u3$(K, U6);
    UKH(K);   // ← undefined when RW4 returns the disabled stub
  }
}, []);

But RW4's body in 2.1.120 returns a stub with only 3 fields:

function RW4(H){
  return {
    onBeforeQuery: async()=>!0,
    onTurnComplete: async()=>{},
    render: ()=>null
  }
}

onSessionRestored and ownsInput are missing. Combined with I = useMemo(()=>!1, []) always being false, the disabled-stub path is the only path, so UKH (and VvH) are guaranteed undefined.

Diff vs 2.1.119

Binary grep on the two stripped binaries (no obfuscation difference, same minifier):

Pattern2.1.119 (43950e9b…)2.1.120 (a6c8e91e…)
UKH(K) call sites02
onSessionRestored:UKH destructure02
onSessionRestored substring03

So 2.1.120 introduced both the destructure and the call site, but the producer (RW4) was not extended to actually return the field. Looks like a partial refactor that shipped without the matching hook update.

Suggested fix

Either:

  1. Add onSessionRestored (and ownsInput) to the RW4 disabled-stub return value (no-op () => {}), or
  2. Guard the call: UKH?.(K) in the mount effect.

(2) is the smaller diff and removes a class of similar regressions.

Workaround for affected users

# Pin to 2.1.119 (last known good)
ln -sfn ~/.local/share/claude/versions/2.1.119 ~/.local/bin/claude
# Optionally disable auto-update channel to prevent re-pull

Tested clean on 2.1.119 with same alias / same session JSONL.

extent analysis

TL;DR

The most likely fix is to add a null check for UKH before calling it, by changing UKH(K) to UKH?.(K) in the mount effect.

Guidance

  • The issue is caused by RW4 not returning onSessionRestored and ownsInput in its disabled-stub return value, making UKH undefined.
  • To fix, either add onSessionRestored and ownsInput to the RW4 return value or guard the call to UKH with UKH?.(K).
  • The smaller diff is to use the optional chaining operator ?. to prevent calling UKH when it's undefined.
  • Users can workaround the issue by downgrading to version 2.1.119.

Example

useEffect(() => {
  if (K && K.length > 0) {
    // ...
    UKH?.(K); // Add null check for UKH
  }
}, []);

Notes

This fix assumes that UKH is not required to be called when RW4 returns the disabled-stub. If UKH is required, then adding onSessionRestored to the RW4 return value is necessary.

Recommendation

Apply the workaround by downgrading to version 2.1.119 until the fix is officially released, as it is a simpler and more straightforward solution.

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] 2.1.120 interactive --resume crashes: `UKH is not a function` (RW4 stub missing onSessionRestored) [3 comments, 4 participants]