claude-code - 💡(How to fix) Fix [BUG] `claude --resume <session-id>` crashes with: ERROR UKH is not a function. (In 'UKH(K)', 'UKH' is undefined) [1 comments, 2 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#53121Fetched 2026-04-26 05:23:52
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

Error Message

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

Error Messages/Logs

Root Cause

Root Cause

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?

Title: crash: UKH (onSessionRestored) is not a function when using --resume

Body:

Description

claude --resume <session-id> crashes with:

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

Steps to Reproduce

  claude --resume <session-id>

Root Cause

In the REPL component, RW4 is called with enabled: false (hardcoded via let I = useMemo(() => false, [])). When disabled, RW4 returns onSessionRestored: undefined.

On mount, when initialMessages are present (as they are during --resume), the component unconditionally calls UKH(K) without guarding for undefined:

  s$.useEffect(() => {
    if (K && K.length > 0)
      ..., UKH(K)  // crashes: UKH is undefined when RW4 is disabled
  }, [])

Fix

Either guard the call (UKH?.(K)) or have RW4 return a no-op stub instead of undefined when enabled is false.

What Should Happen?

Either guard the call (UKH?.(K)) or have RW4 return a no-op stub instead of undefined when enabled is false.

Error Messages/Logs

Steps to Reproduce

Looking at the crash, the bug is clear from the minified source.

The problem: UKH (aliased as onSessionRestored) is undefined when called.

Here's the chain:

  1. I is initialized as permanently false: let I = s$.useMemo(() => !1, [])
  2. RW4 is called with enabled: I (i.e., enabled: false): let {onBeforeQuery:FKH, onTurnComplete:vvH, onSessionRestored:UKH, ...} = RW4({enabled: I, ...})
  3. When enabled is false, RW4 returns onSessionRestored: undefined instead of a function.
  4. The useEffect that runs on mount unconditionally calls UKH(K) when initialMessages exist: s$.useEffect(() => { if (K && K.length > 0) ..., UKH(K) // ← crashes: UKH is undefined }, [])

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.120

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

in ssh terminal on latest debian with claude code

extent analysis

TL;DR

The issue can be fixed by guarding the call to UKH(K) or having RW4 return a no-op stub instead of undefined when enabled is false.

Guidance

  • Verify that RW4 returns undefined for onSessionRestored when enabled is false by checking the implementation of RW4.
  • Guard the call to UKH(K) using optional chaining (UKH?.(K)) to prevent the crash.
  • Consider modifying RW4 to return a no-op stub instead of undefined when enabled is false to handle this case more robustly.
  • Review the code to ensure that UKH is only called when it is defined and has the expected function signature.

Example

s$.useEffect(() => {
  if (K && K.length > 0)
    ..., UKH?.(K)  // guard the call to UKH(K)
}, [])

Notes

The root cause of the issue is the unconditional call to UKH(K) when UKH is undefined. The fix should ensure that UKH is only called when it is defined and has the expected function signature.

Recommendation

Apply workaround: Guard the call to UKH(K) using optional chaining (UKH?.(K)) to prevent the crash, as this is a straightforward and non-invasive fix.

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