[BUG] Hooks fail when user profile path contains spaces
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment:
- Windows 11, bash shell
- Username path: C:\Users\Lea Chan\ (contains space)
Problem:
Hook commands fail with: bash: /c/Users/Lea: No such file or directory
${CLAUDE_PLUGIN_ROOT} expands to a path with a space, and despite the command string using escaped quotes around it ("python \"${CLAUDE_PLUGIN_ROOT}/hooks/stop.py\""), bash word-splits the path at the space.
Affected hooks: All hookify hooks (PreToolUse, PostToolUse, Stop, UserPromptSubmit)
Expected: Hooks should work regardless of spaces in the user's home directory path.
What Should Happen?
Suggested fix: Ensure the expanded CLAUDE_PLUGIN_ROOT value is properly quoted when passed to bash -c. The issue is likely in how the hook runner constructs and invokes the shell command, not in hooks.json itself.
Error Messages/Logs
Stop hook error: Failed with non-blocking status code: bash: /c/Users/Lea: No such file or directory
Steps to Reproduce
Enter any instruction in claude code if hookify ${CLAUDE_PLUGIN_ROOT} file location has spaces, hook will fail.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.86
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗