[Bug] ENOENT error when current working directory is deleted or moved
Bug Description
Title: Unhelpful ENOENT: Bun could not find a file on startup when cwd was deleted/moved
What happened:
Running claude (or any subcommand, e.g. claude --version) from a shell whose current working directory had been moved or deleted fails immediately with:
ENOENT: Bun could not find a file, and the code that produces this error is missing a better error.
Cause:
The Bun-compiled binary resolves the current working directory at startup. When the cwd is a stale/dangling inode, Bun surfaces this raw ENOENT with no context. Even claude --version fails, so it happens before any command logic runs.
Expected:
A clear, actionable message, e.g.:
▎ Your current directory no longer exists (it may have been moved or deleted). cd to a valid directory and try again.
Suggested fix:
Wrap startup in a process.cwd() validity check and print the friendly message on failure.
Environment:
- Claude Code v2.1.198
- macOS (Darwin 25.5.0), arm64
- Install: ~/.local/bin/claude → ~/.local/share/claude/versions/2.1.198
Environment Info
- Platform: darwin
- Terminal: xterm-256color
- Version: 2.1.198
- Feedback ID: d76adc5e-9994-4ce1-970a-b716d1261a96
Errors
[]