Windows: Hooks fail when user path contains spaces (unquoted ${CLAUDE_PLUGIN_ROOT})
Resolved 💬 5 comments Opened Jan 3, 2026 by zeon01 Closed Mar 3, 2026
Problem
Hooks fail to execute on Windows when the user's path contains spaces (e.g., C:\Users\KHAN GADGET\...). The Python interpreter receives a truncated path and cannot find the script.
Error Message
PreToolUse:Callback hook blocking error from command: "callback":
C:\Users\JOHN DOE\AppData\Local\Python\pythoncore-3.14-64\python.exe: can't open file 'C:\Users\JOHN': [Errno 2] No such file or directory
The path is split at the space, so Python receives C:\Users\KHAN instead of the full path.
Root Cause
In hooks/hooks.json, the ${CLAUDE_PLUGIN_ROOT} variable is not quoted:
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/callback.py"
On Windows with spaces in the path, this expands to:
python3 C:\Users\JOHN DOE\.claude\plugins\...\hooks\callback.py
Which the shell interprets as two separate arguments.
Fix
Quote the path variable:
"command": "python \"${CLAUDE_PLUGIN_ROOT}/hooks/callback.py\""
Also note: python3 should be python on Windows for better compatibility.
Environment
- OS: Windows 11
- Username/Path: Contains space
- Claude Code: Latest
- Plugins affected: hookify, security-guidance
Affected Files
All command entries in hooks/hooks.json for both plugins:
matcherhookcallbackhookmatchToolResulthookcallbackToolResulthook
Suggested Change
- "command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/callback.py"
+ "command": "python \"${CLAUDE_PLUGIN_ROOT}/hooks/callback.py\""
Apply to all hook commands in both hookify and security-guidance plugins.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗