[BUG] SessionEnd hook cancelled with "Request interrupted by user" on Ctrl+C in Version 2.1.72
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
SessionEnd hook is cancelled with "Hook cancelled.[Request interrupted by user]" when the Claude Code session is terminated via Ctrl+C (user interrupt). The hook process is killed before it can execute any cleanup logic.
This is a regression — prior versions ran the SessionEnd hook to completion regardless of the session exit path.
What Should Happen?
SessionEnd should always run to completion regardless of how the session exits (normal /exit, Ctrl+C). The contract of a teardown hook is guaranteed execution — cancelling it on interrupt makes it unreliable.
Error Messages/Logs
SessionEnd hook [command] failed: Hook cancelled.[Request interrupted by user]
Steps to Reproduce
- Configure a SessionStart async hook that spawns a long-lived background, paired with a synchronous SessionEnd hook to stop it:
{
"hooks": {
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "my-start-script"
}]
}],
"SessionEnd": [{
"hooks": [{
"type": "command",
"command": "my-stop-script"
}]
}]
}
}
- Start a Claude Code session
- Press Ctrl+C to interrupt the session
- SessionEnd hook fires but is immediately cancelled before reading stdin
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.71
Claude Code Version
2.1.72
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
The hook is cancelled before any user code runs, so there is no way to detect or recover from this within the hook itself — there is currently no workaround.
Impact: any hook relying on SessionEnd is broken on user interrupt.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗