You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bun.spawn throws incorrect ENOENT error when cwd does not exist #24012
bun -e 'Bun.spawn(["/bin/echo"], { cwd:"/nonexistent" })'
What is the expected behavior?
Indicate that the directory /nonexistent does not exist.
1 | Bun.spawn(["/bin/echo"], { cwd:"/nonexistent" })
^
ENOENT: no such file or directory, posix_spawn '/nonexistent'
path: "/nonexistent",
syscall: "posix_spawn",
errno: -2,
code: "ENOENT"
at /home/haris/[eval]:1:5
at loadAndEvaluateModule (2:1)
Bun v1.3.0 (Linux x64)
What do you see instead?
It complains that the executable /bin/echo does not exist, but it does.
1 | Bun.spawn(["/bin/echo"], {cwd:"/nonexistent"})
^
ENOENT: no such file or directory, posix_spawn '/bin/echo'
path: "/bin/echo",
syscall: "posix_spawn",
errno: -2,
code: "ENOENT"
at /home/haris/[eval]:1:5
at loadAndEvaluateModule (2:1)
Bun v1.3.0 (Linux x64)
Additional information
I might take a stab at fixing it if I can set up my development environment and no one beats me to it.
Activity
github-actions commentedon Oct 23, 2025
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
fix: Validate working directory exists before spawning ripgrep
fix(ci): use node:child_process.spawn instead of Bun.spawn for test s…
fix(ci): skip CLI subprocess tests in CI due to Bun posix_spawn bug
修复:createTools 的 workspace 绝对性判断改为平台感知,Windows 四轮红是真凶