Skip to content

fix(hooks): unquoted ${CLAUDE_PLUGIN_ROOT} in hooks.json breaks all hooks on Windows usernames with a space #61

Description

@avilamichael

Environment

  • OS: Windows 11 Pro (build 26200)
  • Warp: v0.2026.05.20.09.21.stable_03
  • Claude Code warp plugin: 2.1.0
  • Hook subprocess shell: Git Bash / MSYS (bash)
  • Windows username contains a space: Michael Avila → home is C:\Users\Michael Avila

Summary

Every hook event fails before the script even runs, because the hook commands in hooks/hooks.json reference the script path unquoted. When the user's home path contains a space (very common on Windows, e.g. First Last), bash word-splits the path and tries to execute the first fragment.

This is a distinct, earlier failure from the /dev/tty / OSC 777 delivery problem tracked in #32, #36, #48 and #54 — those assume the script runs but can't deliver the notification. Here the script never starts, so notifications can't possibly work and Claude Code surfaces a hook error on every tool call. The space-in-username angle was already noted by @MillhioreBT in a comment on #32, but it isn't tracked as its own issue or diagnosed/fixed.

Actual behavior

On every hook event (most visibly PostToolUse), Claude Code shows:

PostToolUse:Read hook error
Failed with non-blocking status code: bash: /c/Users/Michael: No such file or directory

Because the PostToolUse hook has no matcher, it fires after every tool (Read, Edit, Bash, MCP calls, etc.), so the error repeats continuously.

Root cause

hooks/hooks.json (plugin 2.1.0) defines all six hooks like this:

{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/on-post-tool-use.sh" }

Claude Code runs the command through bash. On this machine CLAUDE_PLUGIN_ROOT expands to:

/c/Users/Michael Avila/.claude/plugins/cache/claude-code-warp/warp/2.1.0

Unquoted, bash splits on the space in Michael Avila, treats /c/Users/Michael as the command and Avila/.../on-post-tool-use.sh as an argument → No such file or directory.

Minimal repro:

PR="/c/Users/First Last/.claude/plugins/cache/claude-code-warp/warp/2.1.0"

# current (unquoted) — breaks:
bash -c "${PR}/scripts/on-post-tool-use.sh"
# bash: /c/Users/First: No such file or directory

# quoted — works:
bash -c "\"${PR}/scripts/on-post-tool-use.sh\""

Steps to reproduce

  1. On Windows, use an account whose username contains a space (home dir C:\Users\First Last).
  2. Install the warp Claude Code plugin with Git Bash available as the hook shell.
  3. Trigger any tool in Claude Code. A hook error appears on every event.

Proposed fix

Quote the path in all six hook commands in hooks/hooks.json:

- "command": "${CLAUDE_PLUGIN_ROOT}/scripts/on-post-tool-use.sh"
+ "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-post-tool-use.sh\""

(applies equally to on-session-start.sh, on-stop.sh, on-notification.sh, on-permission-request.sh, on-prompt-submit.sh, and on-post-tool-use.sh.)

Alternatively, use the exec (args) form so the path bypasses the shell parser entirely:

{ "type": "command", "command": "bash", "args": ["${CLAUDE_PLUGIN_ROOT}/scripts/on-post-tool-use.sh"] }

Note: the scripts themselves already quote their internal variables correctly ("$SCRIPT_DIR/..."); only the entrypoint command in hooks.json is unquoted, so this is a one-line-per-hook fix.

Happy to open a PR with the quoting fix and test it on Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions