[BUG] Hooks fail with posix_spawn '/bin/sh' ENOENT due to sandbox restrictions
Resolved 💬 8 comments Opened Jan 23, 2026 by 24601 Closed Mar 26, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Plugin hooks (Stop, PostToolUse, etc.) fail with ENOENT: no such file or directory, posix_spawn '/bin/sh' when Claude Code's sandbox is active.
Error Message:
⏺ Ran 3 stop hooks
⎿ Stop hook error: Failed with non-blocking status code: Error occurred while executing hook command: ENOENT: no such file or directory, posix_spawn '/bin/sh'
⎿ Stop hook error: Failed with non-blocking status code: Error occurred while executing hook command: ENOENT: no such file or directory, posix_spawn '/bin/sh'
⎿ Stop hook error: Failed with non-blocking status code: Error occurred while executing hook command: ENOENT: no such file or directory, posix_spawn '/bin/sh'
Root Cause:
/bin/shexists on the system and works fine for normal Bash tool operations- Hooks are wrapped internally by Claude Code using
/bin/sh -c "..." - The sandbox profile doesn't include
/bin/shin its visible filesystem for hook execution
Environment:
- macOS Darwin 25.2.0 (Apple Silicon)
/bin/shexists:-rwxr-xr-x 1 root wheel 101232 Nov 22 06:49 /bin/sh- Plugins with Stop hooks: Axiom, Flow-next, Hookify
What Should Happen?
Hooks should execute successfully. The sandbox should either:
- Include
/bin/shin the visible filesystem for hook execution - Use a different execution method that doesn't rely on
/bin/sh - Fall back gracefully if
/bin/shis unavailable
Error Messages/Logs
ENOENT: no such file or directory, posix_spawn '/bin/sh'
Steps to Reproduce
- Install plugins that register Stop hooks (e.g., Axiom, Flow-next, Hookify)
- Start a Claude Code session
- End the session (triggers Stop hooks)
- Observe the 3 hook errors
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Latest (2026-01-22)
Platform
Anthropic Console (claude.ai)
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Related to #15026 (pgrep ENOENT) - both are sandbox visibility issues where system binaries aren't accessible in the sandboxed hook execution context, despite being available for normal Bash tool operations.
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗