[BUG] security-guidance plugin hook fails on Windows paths with spaces Body

Resolved 💬 3 comments Opened Dec 27, 2025 by gharehyazie Closed Feb 14, 2026

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?

The security-guidance plugin's PreToolUse hook fails to execute on Windows when the user's home directory path contains spaces (e.g., C:\Users\John Doe\.claude\...).

The hook command in plugins/security-guidance/hooks/hooks.json is:
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/security_reminder_hook.py"

When ${CLAUDE_PLUGIN_ROOT} expands to a path with spaces, the shell interprets the space as an argument separator, causing python3 to receive only the first part of the path.

This completely blocks all Edit, Write, and MultiEdit operations while the plugin is enabled.

The same issue exists in plugins/hookify/hooks/hooks.json.

What Should Happen?

The hook should execute the Python script successfully regardless of whether the plugin path contains spaces. The Edit, Write, and MultiEdit tools should work normally with the security reminder appearing as intended.

The fix is to wrap the path in quotes:
"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/security_reminder_hook.py\""

Error Messages/Logs

python3: can't open file 'C:\\Users\\Mohammad': [Errno 2] No such file or directory

Steps to Reproduce

  1. Have a Windows username with a space (e.g., "John Doe", "Mohammad Gharehyazie")
  2. Install Claude Code on Windows
  3. Enable the security-guidance plugin
  4. Start a new Claude Code session
  5. Try to use the Write or Edit tool on any file
  6. Observe the error blocking the operation

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.76 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗