Stop hooks fail with ENOENT after worktree cleanup
Resolved 💬 3 comments Opened Mar 26, 2026 by cballou Closed Apr 30, 2026
Stop hooks fail with ENOENT: no such file or directory, posix_spawn '/bin/sh' when the session's cwd is a worktree that was removed (post-merge cleanup). The OS can't resolve the deleted cwd to
spawn the hook process. Node.js misleadingly reports ENOENT on /bin/sh rather than the cwd. Suggested fix: fall back to the original repo root or $HOME when cwd doesn't exist.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗