claude-code - 💡(How to fix) Fix [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 [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52983Fetched 2026-04-25 06:15:32
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

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>

Root Cause

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.

Fix Action

Fix / Workaround

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.

  • npm update -g @anthropic-ai/claude-code to 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 claude
  • mv ~/.bashrc ~/.bashrc.bak and relaunching
  • Installing bubblewrap (sudo dnf install bubblewrap)

Code Example

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>
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. Fresh AlmaLinux 9 x86_64 system, non-root user.
  2. Install Node.js and npm from the standard AlmaLinux repositories.
  3. Install Claude Code: npm install -g @anthropic-ai/claude-code
  4. Launch Claude Code in any directory (tested in /tmp, in $HOME, and in a project dir — all reproduce): cd /tmp && claude
  5. Inside Claude Code, at the prompt, ask: run echo hi
  6. 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-code to 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 claude
  • mv ~/.bashrc ~/.bashrc.bak and 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.

extent analysis

TL;DR

The issue can be resolved by fixing the malformed Bash invocation in the snapshot creator or by exposing an environment variable to skip snapshot creation.

Guidance

  • The error is caused by the incorrect order of arguments in the Bash invocation: /bin/bash -c -l SNAPSHOT_FILE=.... The -c option consumes the next argument as the command string, so -l becomes the command string instead of an option.
  • To verify the issue, check the debug log for the "Shell snapshot creation failed" error and the "Unable to read input file: Is a directory" message.
  • As a temporary workaround, try setting the CLAUDE_CODE_DISABLE_SHELL_SNAPSHOT environment variable to 1 before launching Claude Code, although this may not be honored by version 2.1.x.
  • The bash --noprofile --norc -c 'echo hi' command works fine, indicating that the issue is specific to the snapshot creation process.

Example

No code snippet is provided as the issue is related to the invocation of Bash and not a specific code snippet.

Notes

The issue is specific to AlmaLinux 9 and Bash 5.1.8, and the provided workarounds did not resolve the issue. The CLAUDE_CODE_DISABLE_SHELL_SNAPSHOT environment variable may not be honored by version 2.1.x.

Recommendation

Apply a workaround by setting the CLAUDE_CODE_DISABLE_SHELL_SNAPSHOT environment variable to 1 before launching Claude Code, although this may not be honored by version 2.1.x. A more permanent fix would require modifying the snapshot creator to use the correct Bash invocation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [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 [1 participants]