Skip to content

Hook payload session_id misattributed after /resume #26563

Closed as duplicate
Closed as duplicate

Description

@gulliversgames

Bug Description

After resuming a session with /resume, the session_id in hook payloads switches to a different, older session ID. All subsequent tool use and prompt events are attributed to the wrong session, while the actual resumed session receives only lifecycle events (SessionStart/SessionEnd).

Environment

  • Claude Code version: Latest (Feb 2026)
  • OS: macOS (Darwin 24.6.0)
  • Shell: zsh

Steps to Reproduce

  1. Have multiple session JSONL files in a project directory (e.g., ~/.claude/projects/<project>/)
  2. End a session (1be8b33f) with /exit
  3. Resume it with /resume selecting 1be8b33f
  4. Interact with the session (send prompts, trigger tool uses)
  5. Observe hook payloads — the session_id field points to a different session (22c210bd)

Evidence

Session 1be8b33f (the one actually resumed and interacted with)

  • JSONL file actively written until 14:58
  • Hook events received:
Time Event Notes
02:43 SessionStart source=clear (original)
02:43–03:42 200+ tool events Normal activity
11:31 SessionEnd reason=prompt_input_exit
11:42:43 SessionStart source=resume
11:42:59 SessionEnd Exit
11:43:13 SessionStart source=resume
(nothing after this) Zero tool use or prompt events

Session 22c210bd (old session, incorrectly receiving events)

  • JSONL file last modified at 02:53 AM (session was done hours ago)
  • Hook events received:
Time Event Notes
02:22 SessionStart Original session, 225 events
11:43:40 SessionStart source=resume — 27 seconds after 1be8b33f was resumed
14:56 UserPromptSubmit Should be 1be8b33f
14:57 PreToolUse/PostToolUse (Bash ×4) Should be 1be8b33f
15:07 UserPromptSubmit + Stop Should be 1be8b33f

Payload confirmation

The session_id field inside the JSON payload delivered to hooks via stdin is 22c210bd-3efd-4575-9390-226dd6c6bca6 for all misattributed events. This is not a downstream processing issue — Claude Code itself is injecting the wrong session_id.

Expected Behavior

After /resume of session 1be8b33f, all hook payloads (SessionStart, tool uses, prompts, Stop) should contain session_id: 1be8b33f-....

Actual Behavior

  • SessionStart lifecycle events are correctly attributed to 1be8b33f
  • All subsequent tool use and prompt events are incorrectly attributed to 22c210bd (a different, older session in the same project)
  • The old session 22c210bd also receives a spurious SessionStart(source=resume) event

Impact

Any hook-based system that tracks sessions (analytics, logging, agent monitoring) will misattribute all activity to the wrong session after a /resume. This makes session-level analytics unreliable.

Activity

  1. github-actions commented on Feb 18, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. CLAUDE_ENV_FILE: session ID mismatch on resume causes env files to be written to wrong directory #24775
    2. [BUG] Hooks receive stale session_id and transcript_path after /exit and --continue #9188
    3. [BUG] --resume in REPL mode fires duplicate SessionStart hook with wrong session_id (spurious startup event) #23932

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. github-actions commented on Feb 22, 2026

    @github-actions

    This issue has been automatically closed as a duplicate of #24775.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  3. github-actions commented on Mar 1, 2026

    @github-actions

    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.

  4. locked as resolved and limited conversation to collaborators on Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions