[BUG] Node.js crash: Cannot find module '/Users/[username]'
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
## Description
Claude Code crashes intermittently with a Node.js module resolution error after running for extended periods.
## Error
node:internal/modules/cjs/loader:1210
throw err;
^
Error: Cannot find module '/Users/jorgevs'
at Module._resolveFilename (node:internal/modules/cjs/loader:1207:15)
at Module._load (node:internal/modules/cjs/loader:1038:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:164:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
## Environment
- Node.js: v20.19.6
- OS: macOS (Darwin 23.6.0)
- Claude Code version: [run
claude --version]
## Reproduction
- Happens after running Claude Code for extended sessions
- The error shows it's trying to execute
/Users/jorgevsas a Node.js module - The path appears truncated (should be
/Users/jorgevs/Documents/Dev/...) requireStack: []indicates this is the entry point, not a require chain
## Analysis
The error suggests something is parsing a path and truncating it after the username. Possibly:
- Environment variable expansion failure
- Path parsing issue in long-running sessions
- State corruption after extended use
## Additional Context
- All custom hooks use properly quoted paths with
$CLAUDE_PROJECT_DIR - Issue persists regardless of custom hook configuration
- Crash happens "after a while" - not immediately on startup
What Should Happen?
No crashes.
Error Messages/Logs
RangeError: Maximum call stack size exceeded
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v20.19.6
➜ Dev node --trace-uncaught ...
node:internal/modules/cjs/loader:1210
throw err;
^
Error: Cannot find module '/Users/jorgevs'
at Module._resolveFilename (node:internal/modules/cjs/loader:1207:15)
at Module._load (node:internal/modules/cjs/loader:1038:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:164:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Thrown at:
at Module._resolveFilename (node:internal/modules/cjs/loader:1207:15)
at Module._load (node:internal/modules/cjs/loader:1038:27)
at executeUserEntryPoint (node:internal/modules/run_main:164:12)
at node:internal/main/run_main_module:28:49
Node.js v20.19.6
Steps to Reproduce
This happens randomly after some time with any chat.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.76 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
code --version
1.107.1
994fd12f8d3a5aa16f17d42c041e5809167e845a
x64
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗