Bug
The PostToolUse: Write|Edit|MultiEdit hook in hooks/hooks.json fires on every file edit in Claude Code and fails:
C:\Users\<user>\AppData\Local\Python\pythoncore-3.14-64\python.exe: can't open file
'C:\Users\<user>\AppData\Roaming\Claude\local-agent-mode-sessions\<session-uuid>\<sub-uuid>\rpm\plugin_<ULID>\scripts\check-sql-files.py':
[Errno 2] No such file or directory
The script exists at that path (confirmed via dir/ls), but Windows-native python.exe cannot open it. Every Write/Edit/MultiEdit surfaces a blocking error in Claude Code, breaking the editing flow.
Environment
- Windows 11
- Claude Code desktop
- Plugin:
cockroachdb@claude-plugins-official v0.1.9
- Python: 3.14.3 (Windows native,
pythoncore-3.14-64)
Root cause
Claude Code resolves ${CLAUDE_PLUGIN_ROOT} to a per-session sandbox path that nests two UUIDs and a ULID:
C:\Users\<user>\AppData\Roaming\Claude\local-agent-mode-sessions\<UUID>\<UUID>\rpm\plugin_<ULID>\
That prefix is ~170 chars. Plus scripts\check-sql-files.py it's ~250 chars — right against Windows' MAX_PATH (260). Windows long-paths support requires HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 1, which is off by default.
So Python's open() fails with Errno 2 even though ls (Cygwin layer) shows the file.
Impact
Affects every Windows user without LongPathsEnabled. The cockroachdb plugin's SQL anti-pattern lint silently breaks the entire Edit flow rather than just failing the check. The PreToolUse hook calling validate-sql.py has the same fragility, just fires less often.
Suggested fixes (any one of these resolves it)
- Wrap the hook so script-not-found exits 0, never blocks. A lint hook should never break editing.
- Inline the check: for scripts this small, embed the regex check directly in the
hooks.json command so no path resolution is needed.
- Use
python not python3 on Windows: the python3 shim under AppData\Local\Microsoft\WindowsApps adds an indirection layer.
- Document the Windows long-path requirement in README.
Local workaround
Remove the PostToolUse block from hooks/hooks.json to stop the noise. Loses the lint feature but unblocks editing.
Reported via Claude Code session, plugin install path:
C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\cockroachdb\0.1.9
Bug
The
PostToolUse: Write|Edit|MultiEdithook inhooks/hooks.jsonfires on every file edit in Claude Code and fails:The script exists at that path (confirmed via
dir/ls), but Windows-nativepython.execannot open it. Every Write/Edit/MultiEdit surfaces a blocking error in Claude Code, breaking the editing flow.Environment
cockroachdb@claude-plugins-officialv0.1.9pythoncore-3.14-64)Root cause
Claude Code resolves
${CLAUDE_PLUGIN_ROOT}to a per-session sandbox path that nests two UUIDs and a ULID:That prefix is ~170 chars. Plus
scripts\check-sql-files.pyit's ~250 chars — right against Windows'MAX_PATH(260). Windows long-paths support requiresHKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 1, which is off by default.So Python's
open()fails withErrno 2even thoughls(Cygwin layer) shows the file.Impact
Affects every Windows user without
LongPathsEnabled. The cockroachdb plugin's SQL anti-pattern lint silently breaks the entire Edit flow rather than just failing the check. ThePreToolUsehook callingvalidate-sql.pyhas the same fragility, just fires less often.Suggested fixes (any one of these resolves it)
hooks.jsoncommandso no path resolution is needed.pythonnotpython3on Windows: thepython3shim underAppData\Local\Microsoft\WindowsAppsadds an indirection layer.Local workaround
Remove the
PostToolUseblock fromhooks/hooks.jsonto stop the noise. Loses the lint feature but unblocks editing.Reported via Claude Code session, plugin install path:
C:\Users\<user>\.claude\plugins\cache\claude-plugins-official\cockroachdb\0.1.9