Summary
On Windows with Claude Code running in Git Bash / MSYS2, all three plugin hooks (SessionStart, SessionEnd, Stop) fail with MODULE_NOT_FOUND whenever the current working directory is on a different drive than %USERPROFILE%.
Observed error (project on D:\, plugin cache on C:\):
Stop hook error: Failed with non-blocking status code: node:internal/modules/cjs/loader:1386
Error: Cannot find module 'D:\c\Users\Gower\.claude\plugins\cache\openai-codex\codex\1.0.4\scripts\stop-review-gate-hook.mjs'
code: 'MODULE_NOT_FOUND'
Note the bogus D:\c\ prefix.
Root Cause
hooks/hooks.json passes ${CLAUDE_PLUGIN_ROOT} directly to node:
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/stop-review-gate-hook.mjs\""
In Git Bash / MSYS2, Claude Code injects CLAUDE_PLUGIN_ROOT in POSIX form (e.g. /c/Users/Gower/.claude/plugins/...). Native node.exe does not understand /c/... — it interprets it as a drive-relative path under the current drive, prepending D: (the project drive) to produce D:\c\Users\..., which does not exist.
This affects all three hooks in 1.0.4/hooks/hooks.json: SessionStart, SessionEnd, Stop.
Repro
- Windows 11 + Claude Code in Git Bash / MSYS2.
- Install
openai/codex-plugin-cc (cached under C:\Users\<user>\.claude\plugins\cache\...).
- Open Claude Code in a project located on a different drive (e.g.
D:\some\project).
- Run anything that triggers the Stop hook (e.g. session ending).
- Observe
Cannot find module 'D:\c\Users\...' error.
Suggested Fix
Wrap the env var with cygpath -w and fall back to the original value when cygpath is unavailable (Linux/macOS). Apply to all three hook commands:
"command": "node \"$(cygpath -w \"${CLAUDE_PLUGIN_ROOT}\" 2>/dev/null || echo \"${CLAUDE_PLUGIN_ROOT}\")/scripts/stop-review-gate-hook.mjs\""
Alternative: normalize CLAUDE_PLUGIN_ROOT inside the .mjs scripts via path.win32 / url.fileURLToPath so the JSON command stays simple.
Local Workaround
Patched hooks.json in the cache copy with the cygpath wrapper above. After the patch, sessions end cleanly with no MODULE_NOT_FOUND. (The patch is lost on plugin update, hence this report.)
Environment
- OS: Windows 11 Pro for Workstations (10.0.26200)
- Shell: Git Bash / MSYS2 (via Claude Code)
- Node.js: v22.22.2
- Plugin:
openai-codex (codex 1.0.4)
- Project drive ≠
%USERPROFILE% drive
Summary
On Windows with Claude Code running in Git Bash / MSYS2, all three plugin hooks (
SessionStart,SessionEnd,Stop) fail withMODULE_NOT_FOUNDwhenever the current working directory is on a different drive than%USERPROFILE%.Observed error (project on
D:\, plugin cache onC:\):Note the bogus
D:\c\prefix.Root Cause
hooks/hooks.jsonpasses${CLAUDE_PLUGIN_ROOT}directly tonode:In Git Bash / MSYS2, Claude Code injects
CLAUDE_PLUGIN_ROOTin POSIX form (e.g./c/Users/Gower/.claude/plugins/...). Nativenode.exedoes not understand/c/...— it interprets it as a drive-relative path under the current drive, prependingD:(the project drive) to produceD:\c\Users\..., which does not exist.This affects all three hooks in
1.0.4/hooks/hooks.json:SessionStart,SessionEnd,Stop.Repro
openai/codex-plugin-cc(cached underC:\Users\<user>\.claude\plugins\cache\...).D:\some\project).Cannot find module 'D:\c\Users\...'error.Suggested Fix
Wrap the env var with
cygpath -wand fall back to the original value whencygpathis unavailable (Linux/macOS). Apply to all three hook commands:Alternative: normalize
CLAUDE_PLUGIN_ROOTinside the.mjsscripts viapath.win32/url.fileURLToPathso the JSON command stays simple.Local Workaround
Patched
hooks.jsonin the cache copy with the cygpath wrapper above. After the patch, sessions end cleanly with noMODULE_NOT_FOUND. (The patch is lost on plugin update, hence this report.)Environment
openai-codex(codex 1.0.4)%USERPROFILE%drive