[BUG] PreToolUse/PostToolUse hook error: node:internal/modules/cjs/loader:1479 on every Bash command
Resolved 💬 2 comments Opened May 24, 2026 by Jwd-gity Closed Jun 25, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What happened
Every Bash command execution shows non-blocking hook errors from both PreToolUse:Bash and PostToolUse:Bash:
PreToolUse:Bash hook error
⎿ Failed with non-blocking status code:
node:internal/modules/cjs/loader:1479
PostToolUse:Bash hook error
⎿ Failed with non-blocking status code:
node:internal/modules/cjs/loader:1479
The hooks themselves work correctly - they execute their logic and return proper results. The error appears to be from Claude Code's internal hook runner, not from the hook scripts.
Expected behavior
No error messages when hooks execute successfully.
Actual behavior
Error messages appear on every Bash command, cluttering the terminal output. The errors are non-blocking and do not affect functionality.
Investigation
- All 10 configured hooks tested individually - all pass with exit code 0
- All hook scripts syntax-checked with
node --check- all pass - All require() dependencies verified - only use built-in
fsmodule - Hook stderr captured - both rtk and context-monitor produce no stderr
- Debug log shows errors from Cursor extension (
zhukunpeng.claude-code-cn-1.0.3) but the terminal Claude Code also reports the same error
Environment
- Claude Code version: 2.1.150
- Node.js version: v24.15.0
- OS: Linux (WSL2)
- Platform: Ubuntu on WSL2
Hooks configuration (settings.json)
{
"PreToolUse": [
{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "rtk hook claude" }] }
],
"PostToolUse": [
{ "matcher": "Agent", "hooks": [{ "type": "command", "command": "node /path/to/agent-return-compress-hook.js" }] },
{ "matcher": ".*", "hooks": [{ "type": "command", "command": "node /path/to/context-monitor.js" }] }
]
}
Additional context
rtkis a statically-linked Rust binary (v0.40.0), not a Node.js script- The error appears even when hooks are NOT invoked (i.e., the error comes from the hook runner itself, not the hook execution)
- The error is labeled "non-blocking" which suggests Claude Code is aware of the issue but still surfaces it
- Cursor IDE's Claude Code extension (
zhukunpeng.claude-code-cn-1.0.3) also shows similar errors in debug logs, suggesting this may be a cross-platform issue with the hook runner infrastructure
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗