claude --resume crashes with 'UKH is not a function' on 2.1.120 (RW4 hook returns missing keys)

Resolved 💬 3 comments Opened Apr 27, 2026 by smm-h Closed Apr 27, 2026

Summary

claude --resume <session-id> crashes on launch in 2.1.120 with UKH is not a function. The bug is a destructure/return-value mismatch in the RW4 hook. Works in 2.1.112 because the affected code path didn't exist yet.

Repro

On 2.1.120, with any non-empty session:

claude --resume <some-session-id>

Crashes immediately with the React error overlay:

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

/$bunfs/root/src/entrypoints/cli.js:9247:5663

Root cause

In the bundled cli.js, RW4 returns three keys:

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

But the call site destructures five:

let {onBeforeQuery: FKH, onTurnComplete: vvH, onSessionRestored: UKH, render: sJ$, ownsInput: VvH} = RW4({enabled: I, ...})

So onSessionRestored (UKH) and ownsInput (VvH) come back undefined.

A useEffect (also in the REPL component) calls UKH(K) unconditionally when initialMessages.length > 0:

useEffect(() => {
  if (K && K.length > 0) {
    $L$(K, K6()),
    yO6({...}),
    eR6(K), Bc(K),
    tOH.current.current = u3$(K, U6),
    UKH(K)   // <-- crash: UKH is undefined
  }
}, [])

This effect only fires when there are initial messages -- exactly what --resume triggers. Fresh sessions don't crash because the effect's body is skipped.

Why 2.1.112 works

onSessionRestored is not present anywhere in the 2.1.112 binary -- the call site, the destructuring, and the effect were all added later. So 2.1.112 has no resume crash.

$ strings .../versions/2.1.112 | grep -c onSessionRestored
0
$ strings .../versions/2.1.120 | grep -c onSessionRestored
3

Fix

Either:

  1. Add the missing keys to RW4's return object so they are no-ops when the hook is "disabled":

``js
function RW4(H) {
return {
onBeforeQuery: async () => true,
onTurnComplete: async () => {},
onSessionRestored: () => {},
ownsInput: () => false,
render: () => null
}
}
``

  1. Or guard the call sites: UKH?.(K) and check VvH before use.

(1) is safer -- the destructuring contract should always be honoured.

Versions affected

  • Broken: 2.1.120 (and likely every version since onSessionRestored was introduced)
  • Works: 2.1.112

I haven't bisected the exact introduction version, but anything between those is a candidate.

Workaround

Pin to 2.1.112 for any session-resume work:

~/.local/share/claude/versions/2.1.112 --resume <session-id>

Environment

  • OS: Linux (Fedora 6.18.16-200.fc43.x86_64)
  • Shell: bash
  • Claude Code installed via the standalone installer (~/.local/share/claude/versions/)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗