fix(hooks): unquoted ${CLAUDE_PLUGIN_ROOT} in hooks.json breaks all hooks on Windows usernames with a space
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- bash
- 领域
- tooling
调研方向
从 hooks/hooks.json 开始,检查调用 ${CLAUDE_PLUGIN_ROOT} 下脚本的全部六个命令条目。针对包含空格的 Git Bash 路径(例如 /c/Users/First Last),验证带引号的命令形式或 exec/args 替代方案。完成标准是每个 hook 都能在 Windows 上成功启动,且不会拆分插件路径。
由索引模型根据 Issue 内容生成。
描述
Environment
- OS: Windows 11 Pro (build 26200)
- Warp:
v0.2026.05.20.09.21.stable_03 - Claude Code
warpplugin: 2.1.0 - Hook subprocess shell: Git Bash / MSYS (
bash) - Windows username contains a space:
Michael Avila→ home isC:\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
- On Windows, use an account whose username contains a space (home dir
C:\Users\First Last). - Install the
warpClaude Code plugin with Git Bash available as the hook shell. - 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.
- 主要语言
- Shell
- 星标
- 234
- 派生
- 59
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
warpdotdev/claude-code-warp 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 85/100
warpdotdev/claude-code-warp#96 · 2 条评论 ·
-
on-stop.sh slurps the entire transcript with jq -s every turn — ~1 GB RSS on long sessions, triggered a host OOM可能已有人在做 @GeiserX 于 20 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
warpdotdev/claude-code-warp#90 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 84/100
查看 warpdotdev/claude-code-warp 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
area/dev-infra area/reliability area/tests
难度 2/5 1-3 小时 新手友好度 66/100
agent-substrate/substrate#3461 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
pypa/advisory-database#412 ·
维护者通常 1 天内回复
-
GEFSv12
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 2 天内回复