Stop hooks fail with ENOENT: posix_spawn '/bin/sh' not found

Resolved 💬 3 comments Opened Mar 25, 2026 by 0xUXDesign Closed Mar 29, 2026

Bug Description

All Stop hooks fail with the error:

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'

This affects every plugin that registers a Stop hook. SessionStart hooks using the same type: "command" pattern work fine — the issue is specific to Stop hook execution.

Reproduction

  1. Have any plugin with a Stop hook registered (e.g., claude-supermemory which runs node ${CLAUDE_PLUGIN_ROOT}/scripts/summary-hook.cjs)
  2. Complete any Claude Code session (let it reach the Stop event)
  3. Observe the error in output

Example output with 3 plugins registering Stop hooks:

⏺ Ran 3 stop hooks
  ⎿  ${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh
  ⎿  node ${CLAUDE_PLUGIN_ROOT}/scripts/summary-hook.cjs
  ⎿  ${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.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'
  ⎿  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'

Verification

  • /bin/sh exists on the system: -rwxr-xr-x 1 root wheel 101232 /bin/sh
  • The scripts themselves run fine when executed directly: node summary-hook.cjs{"continue":true}
  • SessionStart hooks with type: "command" work correctly in the same session
  • The Bash tool can spawn shells without issues during the session
  • Consistent across sessions — not intermittent

Environment

  • OS: macOS (Darwin 24.6.0)
  • Shell: zsh
  • Claude Code version: CLI (latest as of 2026-03-25)
  • Affected plugins: Any plugin with Stop hooks (tested with claude-supermemory, ralph-wiggum, ralph-loop)

Impact

Plugins relying on Stop hooks for cleanup or persistence (e.g., supermemory's auto-save session summary) silently fail every session. The errors are non-blocking so sessions continue, but the Stop hook functionality is completely broken.

Expected Behavior

Stop hooks should be able to spawn /bin/sh the same way SessionStart hooks do, and execute their registered commands.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗