Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Agent Shell calls that match a beforeShellExecution hook with failClosed: true are blocked by a Cursor-internal spawn failure. The configured hook command is bash scripts/deliver.sh gate, but ExtHost fails with spawn /bin/zsh ENOENT before the hook produces any stdout. The agent UI treats that as a fail-closed denial.
On this machine /bin/zsh exists (SHELL=/bin/zsh). The same bash …/deliver.sh gate succeeds when run via the agent Shell tool outside the hook path.
Verbatim agent error:
Hook "bash scripts/deliver.sh gate" failed with exit code 1: execution error: spawn /bin/zsh ENOENT
Tool blocked because this hook is configured to fail closed (block when it fails).
Hooks log excerpt:
Command: bash scripts/deliver.sh gate (3ms) exit code: 1
INPUT: { ..., "sandbox": true, "cwd": "", "cursor_version": "3.27.22", ... }
OUTPUT: (empty)
STDERR: execution error: spawn /bin/zsh ENOENT
exthost.log:
[ExtHostShellExec] Hook execution error: spawn /bin/zsh ENOENT
Steps to Reproduce
- Install/enable a plugin or user beforeShellExecution hook with failClosed: true, for example:
{
"version": 1,
"hooks": {
"beforeShellExecution": [
{
"command": "bash scripts/deliver.sh gate",
"matcher": "gh pr create|git push",
"timeout": 10,
"failClosed": true
}
]
}
}
- In Agent chat, run a Shell command that matches the matcher (e.g.
git pushorgh pr create). - Observe the agent Shell call blocked with
execution error: spawn /bin/zsh ENOENT. - Check Output → Hooks / cursor.hooks.*.log: empty OUTPUT, STDERR
execution error: spawn /bin/zsh ENOENT, and exthost[ExtHostShellExec] Hook execution error: spawn /bin/zsh ENOENT. - Confirm
/bin/zshexists on the host and that running the samebash …/deliver.sh gatevia agent Shell (without matching the gated command) works.
Expected Behavior
ExtHost should run the configured bash hook command (or an available shell) and not fail spawning /bin/zsh when it exists on the host.
Alternatively: a Cursor-internal failure to spawn the hook should be recoverable / not treated as a policy denial under failClosed (same ask as the MainThreadShellExec not initialized report linked in Additional Information).
Operating System
MacOS
Version Information
Cursor 3.27.22 · VSCode 1.128.0 · commit b1aa50cb6db8 · macOS 27.2.0 Darwin arm64
For AI issues: which model did you use?
Grok 4.5 (Cursor agent)
For AI issues: add Request ID with privacy disabled
Conversation id: 7aa4ed92-e56d-4857-b3e7-82c8769115f1
Generation id (one failure): a125c309-f0b6-4d9c-88f4-dad75ca990c2
Additional Information
Related (max 2 links for new-user limit):
- Closest failClosed internal-spawn issue (different error string; staff invited fresh reports): Agent Shell hard-locks: fail-closed beforeShellExecution + MainThreadShellExec not initialized
- Different family (zsh missing on remote/devcontainer — NOT this case; /bin/zsh exists here): Cursor Agent shell commands not working in devcontainer
Notable hook INPUT during failure: sandbox true and empty cwd.
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor