Skip to content

Hooks fail when user profile path contains spaces #26

@ashifhusainoo7

Description

@ashifhusainoo7

Bug

The hook commands in hooks/hooks.json fail on Windows when the user profile path contains spaces (e.g., C:\Users\Asif Husain\).

Error

Stop hook error: Failed with non-blocking status code: File "C:\Users\Asif", line 1
    /c/AMP
    ^
SyntaxError: invalid syntax

Cause

The ${CLAUDE_PLUGIN_ROOT} variable expands to a path with spaces, but the commands in hooks.json don't quote it:

"command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/trigger.py || python ${CLAUDE_PLUGIN_ROOT}/scripts/trigger.py"

The shell splits the path at the space, so Python receives C:\Users\Asif as the script path instead of the full path.

Fix

Quote the expanded variable in all commands:

"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/trigger.py\" || python \"${CLAUDE_PLUGIN_ROOT}/scripts/trigger.py\""

This affects all four hook entries: PreToolUse, PostToolUse, Stop, and SubagentStop.

Environment

  • Windows 11 Pro
  • Plugin version: 0.8.2
  • Shell: bash (Git Bash)

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