Skip to content

Cursor on Windows: SessionStart hook fails when PATH bash is WSL; use run-hook.cmd in hooks-cursor.json #912

@freezemusic

Description

@freezemusic

Summary

On Windows, hooks/hooks-cursor.json runs ./hooks/session-start directly. Depending on how Cursor spawns the hook, the resolved bash may come from PATH. The first bash on PATH is often C:\Windows\System32\bash.exe (WSL launcher). If WSL is missing or misconfigured, the hook fails and SessionStart does not inject additional_context.

Environment

  • Windows 10/11
  • Cursor + Superpowers (.cursor-plugin with hooks/hooks-cursor.json)
  • Git for Windows installed (C:\Program Files\Git\bin\bash.exe)

Expected

SessionStart should reliably execute session-start on Windows without requiring users to reorder PATH or disable WSL shims.

Actual

From PowerShell, bash .\hooks\session-start (PATH bash) can fail with WSL errors such as:

execvpe(/bin/bash) failed: No such file or directory

Running the same script with Git’s bash explicitly succeeds (exit 0) and prints valid JSON with additional_context when CURSOR_PLUGIN_ROOT is set to the plugin root.

Proposed fix

Mirror the Claude Code path in hooks.json: invoke hooks/run-hook.cmd session-start from Cursor’s hook config (with plugin-root substitution if supported, e.g. analogous to "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start).

run-hook.cmd already prefers Git for Windows bash in standard install locations, then falls back to where bash.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions