[BUG] Claude fails to launch when the working directory does not exist, displaying an error message.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: 1.0.55 (Claude Code), although it might have been 1.0.54.
- Operating System: WSL Ubuntu 22.04 -->
- Terminal: bash
Bug Description
I created a worktree, launched Claude Code in that directory, and then used a command like "remove" to clean up the worktree. After that, I wanted to run commands like "claude mcp list" or "claude --version", but no matter what arguments I used, I kept getting errors.
Expected Behavior
Regardless of what the specification should be, I think "claude --version" should work regardless of whether you're in the current directory or not.
Additional Context
ubuntu@roku-pc:~/workbench/projects/claude-code-event-notifier-bugfix$ claude --continue
node:internal/bootstrap/switches/does_own_process_state:142
cachedCwd = rawMethods.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:142:28)
at NZB (file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:33710)
at file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:34317
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -2,
code: 'ENOENT',
syscall: 'uv_cwd'
}
Node.js v22.17.0
ubuntu@roku-pc:~/workbench/projects/claude-code-event-notifier-bugfix$ claude --continue
node:internal/bootstrap/switches/does_own_process_state:142
cachedCwd = rawMethods.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:142:28)
at NZB (file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:33710)
at file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:34317
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -2,
code: 'ENOENT',
syscall: 'uv_cwd'
}
Node.js v22.17.0
ubuntu@roku-pc:~/workbench/projects/claude-code-event-notifier-bugfix$ claude
node:internal/bootstrap/switches/does_own_process_state:142
cachedCwd = rawMethods.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:142:28)
at NZB (file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:33710)
at file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:34317
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -2,
code: 'ENOENT',
syscall: 'uv_cwd'
}
Node.js v22.17.0
ubuntu@roku-pc:~/workbench/projects/claude-code-event-notifier-bugfix$ claude --version
node:internal/bootstrap/switches/does_own_process_state:142
cachedCwd = rawMethods.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:142:28)
at NZB (file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:33710)
at file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:34317
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -2,
code: 'ENOENT',
syscall: 'uv_cwd'
}
Node.js v22.17.0
ubuntu@roku-pc:~/workbench/projects/claude-code-event-notifier-bugfix$ claude mcp list
node:internal/bootstrap/switches/does_own_process_state:142
cachedCwd = rawMethods.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:142:28)
at NZB (file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:33710)
at file:///home/ubuntu/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:34317
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -2,
code: 'ENOENT',
syscall: 'uv_cwd'
}
Node.js v22.17.0
ubuntu@roku-pc:~/workbench/projects/claude-code-event-notifier-bugfix$
I also get this error (on mac):
> claude node:internal/bootstrap/switches/does_own_process_state:142 cachedCwd = rawMethods.cwd(); ^
Error: ENOENT: no such file or directory, uv_cwd
I am coming across the same issue, any fix for this, yet ?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Issue happened from my end with the following error:
`claude node:internal/bootstrap/switches/does_own_process_state:142 cachedCwd = rawMethods.cwd(); ^
Error: ENOENT: no such file or directory, uv_cwd at wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:142:28) at Fo2 (file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:9:19669) at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:9:26716 at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:567 at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:11:227 at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:567 at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:12:636 at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:567 at file:///home/user/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:4760:3661 at ModuleJob.run (node:internal/modules/esm/module_job:271:25) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } `
EDIT: This was fixed after closing the current wsl session and reopening a new one and running claude command