claude-code - 💡(How to fix) Fix [Bug] Session resume crashes: undefined onSessionRestored callback in v2.1.119 [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#53347Fetched 2026-04-26 05:18:06
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
1
Author
Timeline (top)
labeled ×4commented ×2cross-referenced ×1
RAW_BUFFERClick to expand / collapse

Bug Description Title: Crash on session resume: UKH is not a function in useSessionResumeHook (v2.1.119)

Body:

Summary

Claude Code crashes immediately when resuming a previous session. The crash happens in the bundled cli.js when the session-restore hook tries to invoke onSessionRestored, which is undefined.

Environment

  • Claude Code version: 2.1.119
  • Platform: Linux 6.8.0-110-generic (Ubuntu)
  • Shell: bash
  • Model in use at crash: Opus 4.7 (1M context)

Steps to reproduce …

Note: Content was truncated.

extent analysis

TL;DR

The crash on session resume is likely due to onSessionRestored being undefined in the useSessionResumeHook, and a potential fix involves ensuring this function is properly defined or handled.

Guidance

  • Verify that onSessionRestored is correctly defined and exported in the relevant module to ensure it's accessible within the useSessionResumeHook context.
  • Check the documentation or source code of useSessionResumeHook for any specific requirements or expectations regarding the onSessionRestored function.
  • If onSessionRestored is supposed to be an optional parameter, consider adding a null check before invoking it to prevent the crash.
  • Review the session restoration logic to ensure it aligns with the expected behavior of the application.

Notes

The provided information does not include the specific code or implementation details of useSessionResumeHook or onSessionRestored, which are crucial for a precise solution. Therefore, the guidance is based on general principles of function invocation and error handling.

Recommendation

Apply a workaround by adding a null check for onSessionRestored before its invocation to prevent the application from crashing, until the root cause of onSessionRestored being undefined can be addressed.

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] Session resume crashes: undefined onSessionRestored callback in v2.1.119 [2 comments, 3 participants]