GSD Version
Installed hook scripts report gsd-hook-version: 1.41.2.
Runtime
Codex CLI
Operating System
Windows
Shell
PowerShell / Windows shell invocation from Codex hooks
What happened?
GSD-managed Codex hooks on Windows can be emitted with POSIX-style single quotes around the hook script path, for example:
command = "\"C:/nvm4w/nodejs/node.exe\" 'C:\\Users\\REDACTED\\.codex\\hooks\\gsd-prompt-guard.js'"
When Codex/Windows executes this command, the single quotes are passed as literal path characters. Node then resolves the hook argument relative to the current working directory and fails with MODULE_NOT_FOUND.
Observed failure shape:
Error: Cannot find module 'C:\Users\REDACTED\Documents\projects\rebno\'C:\Users\REDACTED\.codex\hooks\gsd-prompt-guard.js''
This surfaced in Codex as repeated hook warnings:
PreToolUse hook (failed)
error: hook exited with code 1
PostToolUse hook (failed)
error: hook exited with code 1
The affected local commands included GSD Node hooks such as:
gsd-prompt-guard.js
gsd-read-guard.js
gsd-workflow-guard.js
gsd-context-monitor.js
What did you expect?
For Windows Codex installs, GSD should emit hook commands using Windows-compatible quoting. For example:
command = "\"C:/nvm4w/nodejs/node.exe\" \"C:/Users/REDACTED/.codex/hooks/gsd-prompt-guard.js\""
or otherwise use a command builder that avoids POSIX single-quote assumptions on Windows.
Steps to reproduce
-
On Windows, have a GSD-managed Codex hook command with a single-quoted script path:
"C:/nvm4w/nodejs/node.exe" 'C:\Users\REDACTED\.codex\hooks\gsd-prompt-guard.js'
-
Execute it through the Windows command shell from a project directory.
-
Node treats the single quotes as literal path characters and fails to load the hook module.
Control check: replacing the script argument with a double-quoted forward-slash path exits successfully:
"C:/nvm4w/nodejs/node.exe" "C:/Users/REDACTED/.codex/hooks/gsd-prompt-guard.js"
Impact
Moderate. The hooks are installed and loaded, but several managed PreToolUse/PostToolUse hooks fail every time they run, adding noisy Codex warnings and disabling the intended guard/context behavior.
Workaround
Manually edit ~/.codex/config.toml or the migrated hook command source and replace single-quoted Windows paths with double-quoted forward-slash paths.
Related
Adjacent to #3362, but this is the Codex-specific Node hook path quoting failure. #3362 discusses PowerShell hook parsing in Gemini and does not cover Node receiving a literal single-quoted Windows path and throwing MODULE_NOT_FOUND.
Privacy Checklist
GSD Version
Installed hook scripts report
gsd-hook-version: 1.41.2.Runtime
Codex CLI
Operating System
Windows
Shell
PowerShell / Windows shell invocation from Codex hooks
What happened?
GSD-managed Codex hooks on Windows can be emitted with POSIX-style single quotes around the hook script path, for example:
When Codex/Windows executes this command, the single quotes are passed as literal path characters. Node then resolves the hook argument relative to the current working directory and fails with
MODULE_NOT_FOUND.Observed failure shape:
This surfaced in Codex as repeated hook warnings:
The affected local commands included GSD Node hooks such as:
gsd-prompt-guard.jsgsd-read-guard.jsgsd-workflow-guard.jsgsd-context-monitor.jsWhat did you expect?
For Windows Codex installs, GSD should emit hook commands using Windows-compatible quoting. For example:
or otherwise use a command builder that avoids POSIX single-quote assumptions on Windows.
Steps to reproduce
On Windows, have a GSD-managed Codex hook command with a single-quoted script path:
Execute it through the Windows command shell from a project directory.
Node treats the single quotes as literal path characters and fails to load the hook module.
Control check: replacing the script argument with a double-quoted forward-slash path exits successfully:
Impact
Moderate. The hooks are installed and loaded, but several managed PreToolUse/PostToolUse hooks fail every time they run, adding noisy Codex warnings and disabling the intended guard/context behavior.
Workaround
Manually edit
~/.codex/config.tomlor the migrated hook command source and replace single-quoted Windows paths with double-quoted forward-slash paths.Related
Adjacent to #3362, but this is the Codex-specific Node hook path quoting failure. #3362 discusses PowerShell hook parsing in Gemini and does not cover Node receiving a literal single-quoted Windows path and throwing
MODULE_NOT_FOUND.Privacy Checklist