hooks: quote ${CLAUDE_PLUGIN_ROOT} so paths with spaces work on Windows#11
Merged
viragtripathi merged 1 commit intoApr 23, 2026
Conversation
On Windows where user profile folders commonly contain spaces
(e.g. C:\Users\First Last\.claude\plugins\...), the unquoted expansion
gets split on whitespace and Python receives a truncated first argument:
python3: can't open file 'C:\Users\First': [Errno 2] No such file or directory
Wrapping the path in double quotes treats it as a single argument
regardless of whitespace. No behaviour change on Linux/macOS.
Fixes cockroachdb#10
There was a problem hiding this comment.
Pull request overview
This PR fixes Windows failures in hook execution by quoting ${CLAUDE_PLUGIN_ROOT} in hooks/hooks.json, preventing whitespace in the expanded plugin path from being split into multiple arguments.
Changes:
- Quote the script path in the
PreToolUsehook command (validate SQL). - Quote the script path in the
PostToolUsehook command (check SQL files).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Thanks @nickolaschang -- great catch and clean fix. I reproduced the bug locally on macOS by creating a path with spaces (
Approved and merging. Appreciate the cross-reference to anthropics/claude-plugins-official#1524 as well. |
viragtripathi
added a commit
that referenced
this pull request
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps
${CLAUDE_PLUGIN_ROOT}in double quotes in both hook commands so the shell treats the expanded path as a single argument even when it contains whitespace.Fixes #10.
The bug
On Windows where user profile folders commonly contain spaces (e.g.
C:\Users\First Last\.claude\plugins\...), the unquoted expansion gets split on whitespace and Python receives a truncated first argument:The plugin's actual functionality is not affected — the hook simply errors and exits — but the error fires after every
Write/Edit/MultiEdit(PostToolUse) and before everymcp__cockroachdb-toolbox__cockroachdb-execute-sql(PreToolUse), creating heavy noise in sessions.The fix
Two-character change per line. No behaviour difference on Linux/macOS where paths typically lack spaces —
"foo"andfooparse identically when there's no whitespace to split on.Test plan
hooks.jsonis still valid JSON after the editC:\Users\Warehouse PC\…): error gone after applying the patch;PostToolUseandPreToolUsehooks now run cleanly