[BUG] Sandbox does not pass PATH to hook execution and git submodule operations on Fedora (merged-usr distro)

Resolved 💬 2 comments Opened Feb 15, 2026 by krisk248 Closed Mar 15, 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?

On Fedora 43 (a merged-usr distro where /bin/usr/bin), Claude Code's sandbox does not pass PATH to hook execution or internal git operations. This causes three failures:

  1. All plugin hooks fail — hooks spawn /bin/sh -c "python3 ..." without any PATH set, so python3: command not found
  2. Plugin installation fails — git submodule scripts can't find sed, basename, uname
  3. MCP servers failnpm error enoent spawn sh ENOENT

The Bash tool works perfectly — it correctly sources env.sh. Only hook execution, plugin git clones, and MCP spawning are affected.

No shell snapshot is created for zsh. The ~/.claude/shell-snapshots/ directory stays empty after launch, so the sandbox has no environment to inherit.

What Should Happen?

  • Hook execution should inherit PATH from the user's shell environment or from ~/.claude/env.sh
  • Git operations for plugin installation should have access to standard system commands (sed, basename, uname)
  • Shell snapshots should be created for zsh shells, not only bash
  • The sandbox should work correctly on merged-usr distros where /bin is a symlink to /usr/bin

Error Messages/Logs

SessionStart:startup hook error
PreToolUse:Bash hook error
PostToolUse:Bash hook error
Stop hook error: Failed with non-blocking status code: /bin/sh: line 1: python3: command not found

Error: Failed to clone repository:
/usr/libexec/git-core/git-submodule: line 7: basename: command not found
/usr/libexec/git-core/git-submodule: line 7: sed: command not found
/usr/libexec/git-core/git-sh-setup: line 77: basename: command not found
/usr/libexec/git-core/git-sh-setup: line 77: sed: command not found
/usr/libexec/git-core/git-sh-setup: line 292: uname: command not found
/usr/libexec/git-core/git-submodule: line 671: sed: command not found
/usr/libexec/git-core/git-submodule: line 671: cmd_: command not found

npm error enoent spawn sh ENOENT
npm error path /home/kannan/Projects/Active/tuner

Steps to Reproduce

  1. Use Fedora 43 (or any merged-usr Linux distro) with zsh as default shell
  2. Install Claude Code natively: curl -fsSL https://claude.ai/install.sh | bash
  3. Configure ~/.claude/env.sh with correct absolute paths including /usr/bin, /bin, /sbin
  4. Install hookify or security-guidance plugin (both use Python hooks)
  5. Launch Claude Code
  6. Observe: hook errors on every tool use, plugin git clone fails, MCP servers fail to spawn
  7. Verify Bash tool works fine: which python3 sed basename git all resolve correctly inside Bash tool
  8. Check ~/.claude/shell-snapshots/ — directory is empty, no zsh snapshot created

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.42 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

System details:

  • Fedora 43, kernel 6.18.9-200.fc43.x86_64
  • bubblewrap 0.11.0, socat installed
  • Native installation at ~/.local/bin/claude
  • claude doctor reports clean (no issues)

Root cause analysis:
Fedora uses merged-usr layout: /bin/usr/bin, /sbin/usr/sbin. The Bash tool correctly sources env.sh and has full PATH. But hook execution, plugin git clones, and MCP server spawning use a separate code path that does not source env.sh or inherit PATH from the shell.

Additionally, no zsh shell snapshot is created — only old stale bash snapshots existed. Without a snapshot, the sandbox subprocess has no environment to inherit.

Likely affects all merged-usr distros: Fedora, Arch Linux, openSUSE Tumbleweed, recent Debian/Ubuntu.

Workaround: Disable plugins that use hooks (hookify, security-guidance, explanatory-output-style). Core Bash tool functionality is unaffected.

View original on GitHub ↗

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