[BUG] Stop hook not outputting any information
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?
I'm trying to write a Stop hook to do an optimization task that requires the hook to insert the results of a script call into the context when Claude Code stops, to help Claude Code know whether certain files have been modified or not between my user prompt and Claude's last Stop.
But I get zero output about the result of a Stop hook, including nothing about it running. The hook seems to run because I can create a hook of touch file.txt, and I see the file get created, however there's no status message from Claude Code at stop indicating that the hook ran, or its result.
I've tried putting echo "TEST" into my test.sh file, and call bash test.sh as the hook, but again, nothing gets outputted.
What Should Happen?
Claude should show the status of the hook like it does for UserPromptSubmit, for example UserPromptSubmit hook succeeded: TEST
So something like Stop: hook succeeded: RESULT. Also, if echo'ing, it should display the results of the echo, so that certain relevant information can be inserted into context across runs automatically.
Error Messages/Logs
> okay, done. write a response
⎿ UserPromptSubmit hook succeeded: TEST USER SUBMIT 123
∴ Thinking…
The user has set up their Stop hook to run bash /mnt/c/Users/null/source/on-stop.sh. They want me to write a response so they can test if the hook fires and they can see the output.
I'll just write a simple response.
● Testing your Stop hook now.
^ As you can see, nothing about the Stop hook got fired.
Steps to Reproduce
- Create
on-stop.shat project root:
#!/bin/bash
echo "CLAUDE CODE STOP HOOK FIRED"
echo "Timestamp: $(date)"
chmod +x on-stop.sh- Run
bash /mnt/c/Users/null/source/on-stop.shto make sure it outputs correctly. - Create a Stop hook with
bash /mnt/c/Users/null/source/on-stop.shas the command
Stop hook contents in .claude/settings.local.json (I can see the /hooks command shows these as loaded as well, and they were added through the /hook command - and it outputted them being added successfully):
{
"permissions": {
"allow": [
// Removed this to keep paste smaller
]
},
"hooks": {
"PostToolUse": [
{
"matcher": "Read",
"hooks": [
{
"type": "command",
"command": "echo \"READ WAS CALLED, TEST HOOK\""
}
]
}
],
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "echo \"TEST USER SUBMIT 123\""
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash /mnt/c/Users/null/source/on-stop.sh"
}
]
}
]
}
}
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.76 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Ubuntu WSL2 on Windows 11, through Windows terminal.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗