TypeError: onSessionRestored is undefined when resuming sessions in 2.1.120
Summary
In Claude Code 2.1.120, running claude --continue (or --resume) crashes the TUI with:
ERROR UKH is not a function. (In 'UKH(K)', 'UKH' is undefined)
at cli.js:9247:5663.
The minified variable UKH is destructured from a session-config object as onSessionRestored. When the TUI mounts and tries to invoke that callback, it's missing → crash.
Repro
# In any directory with an existing Claude Code session history
claude --continue
The error appears immediately on TUI mount. The session UI never becomes interactive.
Confusing aspect
The stack trace shows lines 9248–9250 of the bundle, which happen to contain the template literal source for the sandbox required but unavailable error. That made it initially look like a sandbox issue. It is not — getSandboxUnavailableReason() is in the same useEffect body, but never executes because UKH(K) throws first.
Surrounding source (relevant part of the same useEffect):
({onBeforeQuery: FKH, onTurnComplete: vvH, onSessionRestored: UKH, ...})
// ...
c(K), tOH.current.current = u3$(K, U6), UKH(K)
onSessionRestored is being destructured from a config object that doesn't always provide it.
Versions tested
- 2.1.119:
claude --continueworks correctly. Session resumes, TUI loads with the conversation banner. - 2.1.120: crash above on every
--continue/--resumeof an existing session.
Confirmed by symlinking ~/.local/bin/claude to each version and re-running the same command in the same directory.
Workaround
Pin to 2.1.119:
ln -sfn ~/.local/share/claude/versions/2.1.119 ~/.local/bin/claude
Environment
- OS: Ubuntu 22.04
- Shell: zsh (login shell
-l) - Claude Code version: 2.1.120 (2.1.119 last working)
- No
sandboxconfig in any settings layer
Suggested fix
Either provide a default no-op for onSessionRestored, or guard the call with UKH?.(K) / if (UKH) UKH(K).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗