[BUG] Bash tool completely unusable on AlmaLinux 9 — shell snapshot creation fails with "Unable to read input file: Is a directory", exit 127 on every command
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?
Every single Bash tool invocation fails with exit code 127 and the error error: Unable to read input file: Is a directory. The actual command (e.g. echo hi) never runs. This makes the Bash tool — and therefore Claude Code as a whole — completely unusable on this machine.
The debug log shows the failure originates in the shell snapshot creation step. Claude Code invokes:
/bin/bash -c -l SNAPSHOT_FILE=/home/<user>/.claude/shell-snapshots/snapshot-bash-<timestamp>-<rand>.sh
echo "# Shell Options" >> "$SNAPSHOT_FILE"
...
-c -l is a malformed argument order for bash: -c consumes its argument as the command string, so -l becomes the command string and the actual snapshot-building script ends up somewhere it shouldn't. From that point on, every subsequent Bash tool call returns the same "Is a directory" error with exit 127 — not just the snapshot step.
This looks related to issue #15649 (macOS ripgrep "Is a directory" noise) but the symptom on AlmaLinux 9 is different and far worse: the error is fatal, not cosmetic. Commands never execute at all. Filtering the error line as suggested in #15649 is not a workaround here because there is no stdout to filter — exit 127 kills the call.
Reinstalling system ripgrep (/usr/bin/rg) and setting USE_BUILTIN_RIPGREP=0 / CLAUDE_CODE_USE_SYSTEM_RIPGREP=1 did not help. Downgrading to 2.1.118, 2.1.117, 2.1.116, and 2.1.114 all reproduce the issue. Deleting ~/.claude/shell-snapshots/*, ~/.claude/cache, and ~/.claude/tmp did not help. Renaming ~/.bashrc to force a minimal environment did not help. Full uninstall + reinstall of the npm package did not help.
What Should Happen?
The Bash tool should execute the command (e.g. echo hi) and return its output normally. Shell snapshot creation should succeed on a standard AlmaLinux 9 system with bash 5.1.8.
Error Messages/Logs
Bash tool output (every command, regardless of what was sent):
● Bash(echo hi)
⎿ Error: Exit code 127
error: Unable to read input file: Is a directory
● Bash(/bin/echo hi)
⎿ Error: Exit code 127
error: Unable to read input file: Is a directory
● Bash(pwd)
⎿ Error: Exit code 127
error: Unable to read input file: Is a directory
Relevant excerpt from ~/.claude/debug/<session>.txt:
2026-04-24T19:06:41.005Z [DEBUG] Creating shell snapshot for bash (/bin/bash)
2026-04-24T19:06:41.005Z [DEBUG] Looking for shell config file: /home/<user>/.bashrc
2026-04-24T19:06:41.033Z [DEBUG] Snapshots directory: /home/<user>/.claude/shell-snapshots
2026-04-24T19:06:41.038Z [DEBUG] Creating snapshot at: /home/<user>/.claude/shell-snapshots/snapshot-bash-1777057601033-b6i49r.sh
2026-04-24T19:06:41.038Z [DEBUG] Execution timeout: 10000ms
2026-04-24T19:06:41.397Z [DEBUG] Shell snapshot creation failed: Command failed: /bin/bash -c -l SNAPSHOT_FILE=/home/<user>/.claude/shell-snapshots/snapshot-bash-1777057601033-b6i49r.sh
echo "# Shell Options" >> "$SNAPSHOT_FILE"
...
error: Unable to read input file: Is a directory
2026-04-24T19:06:41.398Z [ERROR] Error: Error: Failed to create shell snapshot: Command failed: /bin/bash -c -l SNAPSHOT_FILE=...
Sanity checks on the environment (all confirm shell/locale/paths are fine):
$ bash --noprofile --norc -c 'echo hi'
hi
$ bash -xc 'true' 2>&1 | tail -5
+ true
$ echo "SHELL=$SHELL"; echo "BASH_ENV=$BASH_ENV"
SHELL=/bin/bash
BASH_ENV=
$ locale | head -3
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)
$ which rg
/usr/bin/rg
$ getenforce
<paste your result here>
Steps to Reproduce
- Fresh AlmaLinux 9 x86_64 system, non-root user.
- Install Node.js and npm from the standard AlmaLinux repositories.
- Install Claude Code:
npm install -g @anthropic-ai/claude-code
- Launch Claude Code in any directory (tested in /tmp, in $HOME, and in a project dir — all reproduce):
cd /tmp && claude
- Inside Claude Code, at the prompt, ask:
run echo hi
- Observe: every Bash tool call returns exit 127 with "error: Unable to read input file: Is a directory". The command never actually executes.
Environment is otherwise clean:
- bash 5.1.8 stock
- LANG=en_US.UTF-8
- ~/.bashrc and /etc/bashrc unmodified from defaults
- bash --noprofile --norc -c 'echo hi' works fine
- system ripgrep present at /usr/bin/rg
- no sudo/selinux denials in the audit log
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
-
Claude Code Version
2.1.119 (also reproduced on 2.1.118, 2.1.117, 2.1.116, 2.1.114)
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Things tried that did NOT resolve the issue:
npm update -g @anthropic-ai/claude-codeto 2.1.119 (fresh install)- Full uninstall + reinstall of the npm package
- Downgrade to 2.1.118, 2.1.117, 2.1.116, 2.1.114 — same error on all
rm -rf ~/.claude/shell-snapshots/* ~/.claude/cache ~/.claude/tmp- Launching from /tmp, $HOME, and the project dir
- Installing system ripgrep (/usr/bin/rg) and setting:
export USE_BUILTIN_RIPGREP=0
export CLAUDE_CODE_USE_SYSTEM_RIPGREP=1
- Disabling snapshot via:
export CLAUDE_CODE_DISABLE_SHELL_SNAPSHOT=1
export DISABLE_BASH_SNAPSHOT=1
export CLAUDE_NO_SHELL_SNAPSHOT=1
(none of these env var names appear to be honored by 2.1.x)
SHELL=/bin/sh claudemv ~/.bashrc ~/.bashrc.bakand relaunching- Installing bubblewrap (
sudo dnf install bubblewrap)
Request: please either (a) fix the malformed /bin/bash -c -l SNAPSHOT_FILE=... invocation in the snapshot creator, or (b) expose a documented env var to skip snapshot creation entirely and fall back to direct bash -c '<cmd>' execution, so the Bash tool remains usable even when snapshot fails. Currently a single failure at snapshot time renders Claude Code completely unusable.
The full debug log is attached.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗