Cursor Hooks On Windows

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

On Windows, any hook command defined in ~/.cursor/hooks.json fails before it runs.

Even the minimal command echo ‘{“continue”:true,“permission”:“allow”}’ exits with --: line 1: 3: Bad file descriptor (stderr) and produces no stdout.

Hooks work when executed manually in a terminal, so the failure happens inside Cursor’s launcher.

Steps to Reproduce

  1. Save the following minimal config to C:\Users<user>.cursor\hooks.json:
 {
     "version": 1,
     "hooks": {
       "beforeSubmitPrompt": [
         { "command": "echo '{\"continue\":true,\"permission\":\"allow\"}'" }
       ]
     }
   }
  1. Restart Cursor (or reload the window) so the new config is loaded.
  2. Open any non-empty workspace and submit a simple prompt (e.g., “test”).
  3. Open Output → Hooks and check the beforeSubmitPrompt entry.

Observed
The command never runs; the Hooks panel shows:

Command: echo '{"continue":true,"permission":"allow"}'
Output: (no output)
Error Output:
--: line 1: 3: Bad file descriptor
--: line 1: 4: Bad file descriptor
exit code: 1

Expected Behavior

Cursor should execute the hook command exactly as defined (in this case, emitting the JSON string so the hook can allow the action). Instead, the Windows launcher fails first, so no hook logic runs.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.38
VSCode Version: 1.93.1
Commit: 24f65d77200b32ab2c45d21b582a4589051f443c

Additional Information

  • Running the same command manually in PowerShell or CMD succeeds; only Cursor’s launcher fails.
  • The same failure occurs for beforeShellExecution.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Same

Just pinging this.

I don’t have the --: line 1: 3: Bad file descriptor error but I get OUTPUT: (empty) in Hooks Output and (no output) in Hooks Execution log. I’m using version 2.1.46 and this used to work.

Colleagues on Mac does not have this error so it seems Windows Specific.

"beforeSubmitPrompt": \[
  {
    "command": "New-Item -Path \"C:\\Temp\\myfile.txt\" -ItemType File"
  }

Tried running simple commands that used to work but now they simply fail. Also tried "echo \"{ \"continue\": true, \"user_message\": \"It Works\" }\"" but nothing works anymore.

Hi there — just checking in.

It’s been about a month without any acknowledgment on this thread, and I wanted to surface it again because Hooks is a core feature for many of us testing Cursor’s newer capabilities.

I completely understand if this is in the backlog or awaiting prioritization, but even a quick confirmation that it’s on the team’s radar would be super helpful.

Cursor has been shipping a lot and growing fast, and we’re running thousands of dollars in prompts through the system each month — so having clarity on issues like this really matters for planning and trust in the platform.

Thanks in advance for any update or even just a status check.

新版本钩子不生效的问题,啥时候解决啊,我在2.1.26版本使用正常

Is it still broke on windows?

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.