Cursor Hooks Bug: Multiple Hooks in Array Only Execute First Hook

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When multiple hooks are defined in the same trigger array (e.g., beforeShellExecution), only the FIRST hook executes. Subsequent hooks in the array are completely ignored, contradicting the official Cursor documentation which shows multiple hooks per trigger as a supported pattern.

Steps to Reproduce

  1. Create two simple test hooks that log execution:

~/.cursor/hooks/hook1.sh:

#!/bin/bash
echo "Hook 1 executed at $(date)" >> /tmp/cursor-hook1.log
echo '{"permission": "allow"}'

~/.cursor/hooks/hook2.sh:

#!/bin/bash
   echo "Hook 2 executed at $(date)" >> /tmp/cursor-hook2.log
   echo '{"permission": "allow"}'

Make them executable: chmod +x ~/.cursor/hooks/*.sh

  1. Configure both hooks in ~/.cursor/hooks.json:
   {
     "version": 1,
     "hooks": {
       "beforeShellExecution": [
         {"command": "./hooks/hook1.sh"},
         {"command": "./hooks/hook2.sh"}
       ]
     }
   }
  1. Restart Cursor (required for hooks.json changes)

  2. Run any shell command via Cursor Agent or terminal (e.g., “ls”)

  3. Check the log files:

    • cat /tmp/cursor-hook1.log → Shows entries :white_check_mark: (Hook 1 executed)
    • cat /tmp/cursor-hook2.log → Empty or doesn’t exist :cross_mark: (Hook 2 never ran)

Expected: Both log files should have entries
Actual: Only hook1.sh executes; hook2.sh is completely bypassed

This contradicts the official Cursor docs pattern showing multiple hooks per trigger:

Expected Behavior

Both hooks should execute sequentially:

  1. hook1.sh runs → logs to /tmp/cursor-hook1.log → returns {“permission”: “allow”}
  2. hook2.sh runs → logs to /tmp/cursor-hook2.log → returns {“permission”: “allow”}
  3. Command proceeds (both hooks allowed it)

If either hook returns {“permission”: “deny”}, the command should be blocked.

This matches the pattern shown in official Cursor documentation where multiple hooks are listed in the same trigger array, implying they should all execute in sequence.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.64
VSCode Version: 1.99.3
Commit: 25412918da7e74b2686b25d62da1f01cfcd27680
Date: 2025-11-06T04:35:14.424Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.0.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

hi @Panolof1 and thank you for the detailed bug report. I forwarded it to the team.

we met the same problem