Skip to content

SessionStart hook fails on Windows when username contains spaces #1142

@artur-paprocki

Description

@artur-paprocki

Bug

The SessionStart hook (run-hook.cmd) fails on Windows when the user's home directory path contains spaces (e.g., C:\Users\Artur Paprocki\).

Error

SessionStart:clear hook error
Failed with non-blocking status code: bash: /c/Users/Artur: No such file or directory

Root Cause

In hooks/hooks.json, the command is:

"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start"

When Claude Code expands ${CLAUDE_PLUGIN_ROOT} and passes the result to bash, the quoting is lost and bash word-splits the path on the space, trying to execute /c/Users/Artur as a command.

Environment

  • OS: Windows 11
  • Claude Code: v2.1.101
  • Superpowers: v5.0.7
  • Username: Artur Paprocki (space in name)

Suggested Fix

Either:

  1. Bypass the .cmd polyglot and invoke bash directly: bash "${CLAUDE_PLUGIN_ROOT}/hooks/session-start"
  2. Or ensure proper quoting survives Claude Code's variable expansion on Windows

Workaround

Manually edit the cached hooks.json to use bash "${CLAUDE_PLUGIN_ROOT}/hooks/session-start" instead of the run-hook.cmd wrapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions