Summary
The auto-deployed context-mode-cache-heal.mjs SessionStart hook fails to launch on Windows when Claude Code uses Git Bash and the project working directory is on a drive other than C:. MSYS path translation rewrites the script path, and node cannot find the module.
Environment
- OS: Windows 11 Pro (10.0.26200)
- Shell used by Claude Code on Windows: Git Bash (MSYS)
- Node: v24.8.0
- context-mode: 1.0.100 (npm + plugin both installed)
- Project cwd at session start:
D:\Data\postit-extractor (non-C: drive)
Symptom
On every session start:
SessionStart:startup hook error
Failed with non-blocking status code: node:internal/modules/cjs/loader:1423
throw err;
^
Error: Cannot find module 'D:\c\Users\shaun\.claude\hooks\context-mode-cache-heal.mjs'
Note the mangled path D:\c\Users\shaun\... — MSYS prepended the cwd's drive letter (D:) to a /c/Users/...-style path it tried to translate.
Hook command (deployed in ~/.claude/settings.json)
{
"type": "command",
"command": "node C:\Users\shaun\.claude\hooks\context-mode-cache-heal.mjs"
}
Root cause
When Claude Code on Windows runs the hook through Git Bash, the JSON-decoded path C:\Users\shaun\... is processed in a way that triggers MSYS path translation. With cwd on D:\, MSYS converts a /c/Users/...-style intermediate form back into D:\c\Users\... — a non-existent path.
Reproduction (cwd on D:):
$ bash -c 'node ~/.claude/hooks/context-mode-cache-heal.mjs'
Error: Cannot find module 'D:\c\Users\shaun\.claude\hooks\context-mode-cache-heal.mjs'
$ bash -c 'node "$HOME/.claude/hooks/context-mode-cache-heal.mjs"'
Error: Cannot find module 'D:\c\Users\shaun\.claude\hooks\context-mode-cache-heal.mjs'
$ bash -c 'node "$USERPROFILE/.claude/hooks/context-mode-cache-heal.mjs"' # exit 0
$USERPROFILE resolves to a native Windows path (C:\Users\shaun) and bypasses MSYS conversion.
Fix
Change the deployed hook command to use $USERPROFILE (or another platform-aware form) on Windows:
"command": "node \"$USERPROFILE/.claude/hooks/context-mode-cache-heal.mjs\""
Verified: works regardless of which drive the project cwd is on.
Other options that also work:
- Use
cmd /c wrapper to avoid bash entirely on Windows
- Inline the script with
node -e so no path is needed
- Detect platform during deploy and emit the appropriate path form
Impact
Anyone on Windows who opens a Claude Code session with a project on a non-C: drive sees a hook error every session-start. The cache-heal logic itself never runs, so the underlying claude-code#46915 workaround silently does nothing for these users.
Workaround for affected users
Manually edit ~/.claude/settings.json and replace the SessionStart hook command with:
"command": "node \"$USERPROFILE/.claude/hooks/context-mode-cache-heal.mjs\""
Summary
The auto-deployed
context-mode-cache-heal.mjsSessionStart hook fails to launch on Windows when Claude Code uses Git Bash and the project working directory is on a drive other thanC:. MSYS path translation rewrites the script path, andnodecannot find the module.Environment
D:\Data\postit-extractor(non-C: drive)Symptom
On every session start:
Note the mangled path
D:\c\Users\shaun\...— MSYS prepended the cwd's drive letter (D:) to a/c/Users/...-style path it tried to translate.Hook command (deployed in
~/.claude/settings.json){ "type": "command", "command": "node C:\Users\shaun\.claude\hooks\context-mode-cache-heal.mjs" }Root cause
When Claude Code on Windows runs the hook through Git Bash, the JSON-decoded path
C:\Users\shaun\...is processed in a way that triggers MSYS path translation. With cwd onD:\, MSYS converts a/c/Users/...-style intermediate form back intoD:\c\Users\...— a non-existent path.Reproduction (cwd on D:):
$USERPROFILEresolves to a native Windows path (C:\Users\shaun) and bypasses MSYS conversion.Fix
Change the deployed hook command to use
$USERPROFILE(or another platform-aware form) on Windows:Verified: works regardless of which drive the project cwd is on.
Other options that also work:
cmd /cwrapper to avoid bash entirely on Windowsnode -eso no path is neededImpact
Anyone on Windows who opens a Claude Code session with a project on a non-
C:drive sees a hook error every session-start. The cache-heal logic itself never runs, so the underlying claude-code#46915 workaround silently does nothing for these users.Workaround for affected users
Manually edit
~/.claude/settings.jsonand replace the SessionStart hook command with: