[BUG] Notification Hook 10 second delay
Open 💬 25 comments Opened Aug 5, 2025 by bkaes
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.69
- Operating System: Ubuntu 24.04.2
- Terminal: Terminal App
Bug Description
~8-10 second delay for Notification Hook
Steps to Reproduce
- Setup a hook for notifications
- Request Claude Code to go into a different directory in order to send me to trigger the notification hook.
Expected Behavior
The notification hook to query and execute immediately
Actual Behavior
[DEBUG] Matched 0 unique hooks for query "LS" (0 before deduplication)
[DEBUG] Found 0 hook commands to execute
10 Second Delay
[DEBUG] Getting matching hook commands for Notification with query: undefined
[DEBUG] Found 1 hook matchers in settings
[DEBUG] Matched 1 unique hooks for query "no match query" (1 before deduplication)
[DEBUG] Notification [echo "$(date): Notification hook triggered, playing sound" >> ~/.claude/hook.log && paplay ~/.claude/sounds/correct-answer.wav &] completed with status 0
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
25 Comments
+1 Having same issue
Environment
Platform:
I've been battling with this for a TTS based on the notification hook. Mine isn't quite 10 seconds but it's lengthy. I though it was my hook handlers and have put extensive logging in my code and my hook handler in Python take 50ms total. Not great but definitely not the 3-6 second delay the hook shows. I have logging of the notification as the first thing that happens and I see the file get written ad is immediately followed by my TTS announcement.
I'm certain it is not my code.
Anthropic API
Claude CLI version: 1.0.72
Operating System: macOS Sequoia 15.6
Terminal: Zsh
same issue here
then delay for 10~20s
I am on windows11, claude code 2.0.0,
CPU: AMD ryzen 9 9950X
Seems I fixed this issue by https://stackoverflow.com/questions/28507014/cygwin-commands-from-cmd-are-slow-from-bash-are-fast. Problem is cygwinis very slow when frist time called on windows.
Has anyone got a fix on linux?
I'm also getting this
Bumping this
This problem is still happening.
im getting this bug too and its really disrupting my workflow at work!
Bumping this again
Bumping this
I want to be notified as soon as possible when Claude needs my attention. These 10 second delays are annoying.
@bcherny @ant-kurt @ashwin-ant Can you help with this? v2.0.37 included "Fixed how idleness is computed for notifications" but there's still a consistent ~10s delay in the notification pipeline.
Binary analysis (v2.0.55) shows a 6-second polling interval (
setIntervalwithewD=6000) in the notification check logic. The remaining ~4 seconds may be subprocess spawn overhead. On Windows/Cygwin, disabling AD lookups in nsswitch.conf reduces the delay, supporting this theory.Relevant timing constants found in the bundled JS:
ewD=6000(notification polling interval)Tz=60000(hook execution timeout)asyncTimeout=15000(async hook timeout)messageIdleNotifThresholdMs=60000(idle notification threshold)Exposing the polling interval as a configurable environment variable would help.
In the meanwhile I had Claude Code make a program that patches this bug on your local binary: https://gist.github.com/cool-RR/dab9b132fb607712a614d487dd554d29
For me it makes the notification hook have <1s delay. Use at your own risk.
I can confirm this bug on Linux with Claude Code 2.0.65. Seems to be much longer than 10 seconds for me though. I'd expect the notification to be instant.
Confirming this bug still exists on v2.0.76 (macOS)
This bug still exists on v2.1.11 on Mac
thank you for this gist. I modified it to work with 2.1.x and included it in my MIT licensed tool,
lemonaid: https://github.com/petergaultney/lemonaid/blob/main/src/lemonaid/claude/patcher.pyUP the issue.
This fix is not working if using Native Install. I tested and it is only works with npm install on windows 11.
I'm seeing this bug on Mac v2.1.39 for Notification hooks as well.
The Stop and SubagentStop fire immediately.
Have this problem on Windows Terminal too. 60 seconds delay...
In my case this solved the problem for 60 second notification delays: https://github.com/anthropics/claude-code/issues/13922#issuecomment-4009049985
Still present on v2.1.116, macOS 15.7.4 (arm64). Adding timing data that might help isolate:
Bumping this.
Same issue with following info:
OS: Windows 10
Terminal: PowerShell
Claude Code Version: 2.1.128
Environment:
Additional datapoint: PermissionRequest and Stop hooks fire almost immediately, while Notification does not.
For the same
Writepermission event, with the permission dialog already visible in the TUI:So the delay is not in the shell script or notification daemon. The
PermissionRequesthook fires immediately, but theNotificationhook for the same permission prompt runs several seconds later.My hypothesis is that PreToolUse, PermissionRequest, and Stop are executed synchronously in the agent loop, while Notification is handled through a deferred or queued path.