Cannot launch in a directory whose path contains a backslash (upstream Bun realpath bug)
Environment
- Claude Code 2.1.201, Linux x64 (native build)
Steps to reproduce
$ mkdir 'a\b' && cd 'a\b' && claude
Error: Can't access working directory /home/user/a\b: Path "/home/user/a\b" does not exist
The directory plainly exists (pwd, ls, and every other tool agree); any
single literal \ anywhere in the absolute cwd path triggers the failure.
Other punctuation and unicode (!, %, quotes, em-dash, emoji) are fine.
Root cause
Bun's realpath resolver converts \ to / on Linux before hitting the
filesystem, so the startup cwd validation resolves a path that doesn't exist
and gets ENOENT. Filed upstream with strace evidence:
https://github.com/oven-sh/bun/issues/33403
strace of Claude Code's own startup shows the same conversion via a
prefix-by-prefix symlink walk — for cwd /tmp/par\ent/leaf it lstats/tmp/par (a prefix that only exists after splitting par\ent at the
backslash) and fails there:
statx(AT_FDCWD, "/tmp", ...AT_SYMLINK_NOFOLLOW...) = 0
statx(AT_FDCWD, "/tmp/par", ...AT_SYMLINK_NOFOLLOW...) = -1 ENOENT
The wrapping error message prints the original, un-converted path — making
the message self-contradictory next to pwd.
Suggested fix
Track the upstream Bun fix, or sidestep realpath in the cwd validation
(existsSync/lstatSync handle these paths correctly in the same process).
Workaround
Rename the directory to not contain a backslash. Note this can arise
accidentally: mkdir 'weird (name\!)' — a \! inside single quotes keeps
the backslash literally, so users get such directories without intending to.