Repository navigation
Description
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?
Environment:
- Claude Code version: 2.0.11
- Platform: Linux
- Hook type affected: All hooks (UserPromptSubmit, Stop, etc.)
- Trigger: /exit followed by claude --continue
When using /exit to close a session and then resuming with claude --continue, all hooks (UserPromptSubmit, Stop, etc.) continue to receive the original session's session_id and transcript_path instead of the current session's values. This persists across multiple exit/continue cycles, causing hooks to read conversations from hours/days ago instead of the current conversation.
Expected Behavior:
Hooks should receive the current session's session_id and transcript_path pointing to the actively-written transcript file.
Actual Behavior:
Hooks receive the first/original session's session_id and transcript_path from when the project directory was first opened, even though Claude Code is writing to a completely different transcript file.
What Should Happen?
When resuming a session with claude --continue, hooks should receive updated metadata:
- session_id: The current session's ID
- transcript_path: Path to the actively-written transcript file for the current session
Each exit/continue cycle should trigger hooks to receive fresh session metadata, not cached values from the initial session. Hooks should always point to the conversation currently being recorded, enabling real-time monitoring and context extraction from the correct transcript.
Steps to Reproduce
Steps to Reproduce:
- Start a Claude Code session in a project directory
- Set up a UserPromptSubmit hook that logs the received JSON (session_id and transcript_path)
- Have a conversation, then use /exit to close
- Resume with claude --continue
- Send a new message
- Check the hook's log
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Claude Code Version
2.0.11
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
Related Issues:
Similar to #3019 (transcript_path after /clear) and #8614 (session ID with --dangerously-skip-permissions), but this affects normal exit/continue workflow.
Activity
github-actions commentedon Oct 9, 2025
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Brandtweary commentedon Oct 20, 2025
Issue resolved as of Claude Code 2.0.24.
After testing with session reloads (/exit followed by claude --continue), the underlying issue has been fixed. The original bug wasn't that Claude Code was passing a "stale" session_id - it was that Claude Code was creating entirely new sessions on reload instead of continuing the existing one. This caused hooks to receive a transcript_path pointing to the old (now-abandoned) transcript file while a new transcript was being written elsewhere. The current behavior correctly maintains the same session_id and transcript_path across reload cycles, with the transcript file continuing to receive updates after resume. Hooks can now reliably use input_data.get('transcript_path') without workarounds to find the most recent transcript.
github-actions commentedon Oct 28, 2025
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.