Windows "Select an app to open" dialog triggers when opening AI chat (.sh file handler issue)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When opening the AI chat panel to start a new chat session, Windows displays a “Select an app to open” dialog. The dialog alternates between asking to open a “session-start” file and asking to open a .sh file. This suggests Cursor is attempting to execute shell scripts via the OS default file handler rather than routing them through an internal shell interpreter. Since Windows has no native .sh handler, the OS falls back to the app picker dialog.

Previously, this only occurred when starting a new chat thread or running a custom command (e.g. a slash command). Now it triggers every time the chat panel is opened, even before sending a message.

The chat itself still functions normally after dismissing the dialog. This is purely an extreme annoyance, not a functional blocker.

Steps to Reproduce

  1. Open Cursor on Windows
  2. Open the AI chat panel (Ctrl+L) or start a new agent session
  3. Windows “Select an app to open” dialog appears, referencing either session-start or a .sh file
  4. Dismiss the dialog, chat works normally after

Expected Behavior

Chat should open without triggering the Windows file association dialog. Any internal shell scripts should be executed through Cursor’s bundled shell/Node environment, not passed to the OS file handler.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Version Information

Version: 2.6.20 (user setup)
VSCode Version: 1.105.1
Commit: b29eb4ee5f9f6d1cb2afbc09070198d3ea6ad760
Date: 2026-03-17T01:50:02.404Z
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

N/A

For AI issues: add Request ID with privacy disabled

N/A

Additional Information

  • Machine is domain-joined via Active Directory, which may enforce file association group policies, although this issue only recently started happening for the first time.
  • Git for Windows is installed and appears in the “Suggested apps” list in the dialog
  • WSL is installed
  • The issue worsened over time: initially only triggered on new threads with slash commands, now triggers on any chat panel open

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, I see a screenshot with the Windows file picker dialog.

This is almost certainly caused by a sessionStart hook that points to a .sh script. When Cursor opens a chat, it tries to run the hook via PowerShell, and Windows doesn’t know what to do with a .sh file, so it shows the system dialog.

Can you check if you have .cursor/hooks.json in the project or ~/.cursor/hooks.json? If yes, please paste its contents. It’s probably a sessionStart with a command like ./session-start.sh.

If that’s confirmed, here’s a workaround:

  1. Rewrite the hook as a .ps1 script, or wrap the call: bash ./hooks/session-start.sh instead of ./hooks/session-start.sh
  2. Detailed guide for hooks on Windows: Hooks in Windows

The team is aware of the issue with .sh hooks on Windows. Let me know what’s in hooks.json and I’ll help you sort it out.

Thanks for the quick response, Dean. I do have a .cursor/hooks.json in my project directory, but there’s no sessionStart hook defined, and none of my hooks reference .sh files. Here’s the full contents:

{
  "version": 1,
  "hooks": {
    "afterFileEdit": [
      {
        "command": "node tooling/hooks/afterFileEdit.mjs"
      }
    ],
    "stop": [
      {
        "command": "node tooling/hooks/stop.mjs"
      }
    ]
  }
}

Both hooks are Node scripts, no shell scripts anywhere in my project or at the user-level ~/.cursor/ directory. I also don’t have a hooks.json at ~/.cursor/hooks.json.

I did some more specific testing and can reliably reproduce two distinct triggers. I’ve attached a screen recording showing the full sequence, but here’s the breakdown:

  1. .sh file dialog: triggers after the AI returns a response, not on send. It does its thinking, returns the response, and then the dialog appears. This happens in both Agent and Ask mode.

  2. session-start dialog: triggers when opening a new chat from a chat that already has history (no longer a blank slate). Every subsequent “new chat” from that state triggers it again.

So it seems like there are two separate internal lifecycle events both trying to invoke either a .sh script or a session-start file, one on response completion and one on new session creation.

I’ve had these hooks set up since the start of this project months ago. The dialog only started appearing roughly a few weeks ago. Initially it was just the .sh file dialog when starting a new thread or running a slash command, but it has since escalated to the current behavior.

Found the root cause: it was Claude Code plugins injecting hooks that Cursor was picking up. The Cursor Hooks settings panel showed 4 configured hooks, not just my 2. The extra two came from Claude Code’s official plugin system:

  • stop — “Ralph Loop” plugin registering stop-hook.sh at C:\Users\...\.claude\plugins\cache\claude-plugins-official\ralph-loop\...\hooks\stop-hook.sh

  • sessionStart — “Superpowers” plugin pointing to ./hooks/session-start

They are .sh scripts with no Windows-compatible fallback, which presumably triggered the Windows file picker dialogs. Uninstalled the Superpowers and Ralph Loop plugins from Claude Code and both dialogs are gone.

So the root issue is twofold: Claude Code’s official plugins seem to be shipping .sh hooks with no Windows support, and Cursor is picking up those hooks and trying to execute them without any platform-aware error handling or shell wrapping. Might be worth noting on Cursor’s side that hooks sourced from external tools could benefit from validation before execution, rather than falling through to the OS file handler when the script isn’t natively executable.

Thanks for the timely responses!

1 Like

Fix: Superpowers .sh hook opening in editor on Windows (Cursor)

Problem: When opening a new agent session in Cursor on Windows, the session-start bash script opens in the editor instead of executing silently. This happens because Cursor tries to run the hook file directly, and Windows doesn’t know how to execute a bash script (or extensionless file containing a bash shebang).

Root cause: The Superpowers plugin ships a hooks-cursor.json pointing to ./hooks/session-start — an extensionless bash script. On Windows, Cursor cannot execute this natively.

Fix: Create a thin PowerShell wrapper that Cursor can execute natively, then point hooks-cursor.json to it.


Step 1 — Find your plugin version folder

Open this path in Explorer and note the hash folder name:

C:\Users\YOUR_USERNAME\.cursor\plugins\cache\cursor-public\superpowers\

There may be multiple hash folders. Check which one Cursor is actually using by looking at Cursor Settings → Hooks — the path shown there tells you the active version.


Step 2 — Create session-start.ps1

Inside the hooks\ subfolder of the active version, create a file named session-start.ps1 with this content (replace the hash with your actual folder name):

& ‘C:\Program Files\Git\bin\bash.exe’ ‘C:/Users/YOUR_USERNAME/.cursor/plugins/cache/cursor-public/superpowers/YOUR_HASH/hooks/session-start’

Verify Git Bash is installed at that path, or adjust accordingly. You can find your bash path with:

where.exe bash


Step 3 — Update hooks-cursor.json

In the same hooks\ folder, open hooks-cursor.json and change:

“command”: “./hooks/session-start”

to:

“command”: “./hooks/session-start.ps1”


Step 4 — Verify it works

From PowerShell, run:

Set-Location “C:\Users\YOUR_USERNAME\.cursor\plugins\cache\cursor-public\superpowers\YOUR_HASH”

& “./hooks/session-start.ps1”

You should see a JSON blob with additional_context containing the Superpowers skill instructions.


Step 5 — Restart Cursor

Fully close and reopen Cursor. The hook will now execute silently via PowerShell.


Notes:

  • This does not affect Claude Code — only hooks-cursor.json (Cursor-specific) is modified, not hooks.json (Claude Code format)

  • The original session-start bash script is untouched; the .ps1 file is just a thin Windows wrapper that calls it

  • If the Superpowers plugin updates, the plugin may create a new hash folder — you’ll need to reapply this fix to the new folder

  • Tested on Windows 11 with Cursor 2.6.x and Git for Windows

Nice find! Claude Code plugins injecting .sh hooks was definitely not the first thing I’d suspect. Glad you tracked it down.

And @Emrah, solid workaround with the PowerShell wrapper for users who want to keep Superpowers running on Windows.

@jamesreyes-c, your point about Cursor needing platform-aware validation before executing hooks is fair. Right now, if a hook points to a .sh file on Windows, it just falls through to the OS file handler. Ideally, it should either wrap it in bash automatically or fail gracefully with a clear error. I’ve flagged this with the team.

If anyone else hits this, check Cursor Settings > Hooks to see if external tools have registered hooks you didn’t expect.

Where does the bug appear (feature/product)?

Somewhere else…

Describe the Bug

Environment

  • OS: Windows 10/11 (build: ___)
  • Cursor version: ___

Actual
Windows shows “How do you want to open this file?” for:

C:\Users\<user>\.cursor\plugins\cache\cursor-public\superpowers\<hash>\hooks\session-start

Notes / hypothesis

  • session-start is a bash hook script with no file extension (intentional in Superpowers for Claude Code compatibility; see plugin’s run-hook.cmd comments).
  • hooks-cursor.json configures: "command": "./hooks/session-start".
  • On Windows, if the host invokes this like a document “open” instead of executing via bash/run-hook.cmd, the shell has no handler for extensionless files → Windows shows the picker.
  • Suggest: on Windows, run Cursor hooks that point at extensionless scripts through the same pattern as Claude Code (run-hook.cmd session-start) or equivalent bash.exe invocation.

Plugin reference

  • Superpowers: hooks/hooks-cursor.jsonsessionStart./hooks/session-start
  • Same plugin ships hooks/run-hook.cmd for Windows-safe bash execution of that script.

Steps to Reproduce

Steps to reproduce

  1. Install/enable the Superpowers plugin (cursor-public marketplace).
  2. Use agent sessions as normal.
  3. Use “Archive all” (or equivalent) for agent sessions.

Expected Behavior

Expected
Archiving completes with no OS file-association dialog.

Operating System

Windows 10/11

Version Information

Version: 2.6.22 (user setup)
VSCode Version: 1.105.1
Commit: c6285feaba0ad62603f7c22e72f0a170dc8415a0
Date: 2026-03-27T15:59:31.561Z
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

Does this stop you from using Cursor

No - Cursor works, but with this issue