claude-code - 💡(How to fix) Fix [BUG] Bash tool returns empty output on RHEL 9 native Linux binary, shell snapshot never written [1 comments, 2 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#52821Fetched 2026-04-25 06:20:01
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

Error Messages/Logs

No error messages surfaced to the user — the Bash tool result is simply "(No output)".

Root Cause

There is no corresponding openat(..., O_WRONLY|O_CREAT, ...) for that snapshot path anywhere in the trace. Claude logs the intent, does statx to verify, finds ENOENT (because nothing was written), and falls through without writing.

Code Example

Bash(echo $$)              (No output)
Bash(bash -c 'echo $$')    (No output)
Bash(printf "%s\n" "$$")   (No output)
Bash(ps -p $$ -o pid=)     (No output)
Bash(date +%N)             (No output)

---

[DEBUG] Creating shell snapshot for bash (/bin/bash)
[DEBUG] Creating snapshot at: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh
[DEBUG] Shell snapshot file not found after creation: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh

---

statx(AT_FDCWD, "/home/fusar/.claude/shell-snapshots/snapshot-bash-1776959846377-lvbzw3.sh", AT_STATX_SYNC_AS_STAT, STATX_ALL, ...) = -1 ENOENT

---

{
  "autoUpdates": false,
  "sandbox": {
    "enabled": false,
    "autoAllowBashIfSandboxed": false,
    "failIfUnavailable": false
  },
  "autoAllowBashIfSandboxed": false,
  "dangerouslyDisableSandbox": true
}

---

From ~/.claude/debug/latest:
[DEBUG] Creating shell snapshot for bash (/bin/bash)
[DEBUG] Looking for shell config file: /home/fusar/.bashrc
[DEBUG] Creating snapshot at: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh
[DEBUG] Shell snapshot file not found after creation: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh
strace excerpt (no openat with O_CREAT|O_WRONLY for the snapshot path anywhere in the full trace):
statx(AT_FDCWD, "/home/fusar/.claude/shell-snapshots/snapshot-bash-1776959846377-lvbzw3.sh", AT_STATX_SYNC_AS_STAT, STATX_ALL, ...) = -1 ENOENT (No such file or directory)
No error messages surfaced to the user — the Bash tool result is simply "(No output)".

---

sudo dnf module install -y nodejs:20

---

sudo dnf install -y bubblewrap socat

---

curl -fsSL https://claude.ai/install.sh | bash -s -- stable

---

claude /login

---

cat > ~/.claude/settings.json <<'EOF'
   {
     "sandbox": {"enabled": false, "autoAllowBashIfSandboxed": false, "failIfUnavailable": false},
     "dangerouslyDisableSandbox": true
   }
   EOF

---

claude -p "Use the Bash tool to run: echo \$\$"

---

strace -f -e trace=openat,write,unlink,rename -o /tmp/st.log \
  claude -p "Use Bash tool to run: echo hello"
grep -E "snapshot-bash.*\.sh" /tmp/st.log

---

inotifywait -m ~/.claude/shell-snapshots/ -e create -e modify -e moved_to -e delete &
claude -p "Use Bash tool to run: echo hello"
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?

Claude Code's Bash tool runs commands but never captures stdout. Every bash invocation returns (No output) in the tool result. Claude then either hallucinates a plausible output or reports "command ran but produced no visible output."

Verified not-a-hallucination via impossible-to-guess probes:

● Bash(echo $$)            ⎿  (No output)
● Bash(bash -c 'echo $$')  ⎿  (No output)
● Bash(printf "%s\n" "$$") ⎿  (No output)
● Bash(ps -p $$ -o pid=)   ⎿  (No output)
● Bash(date +%N)           ⎿  (No output)

Smoking gun: strace evidence

Claude's debug log claims it creates the shell snapshot:

[DEBUG] Creating shell snapshot for bash (/bin/bash)
[DEBUG] Creating snapshot at: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh
[DEBUG] Shell snapshot file not found after creation: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh

strace during the same operation:

statx(AT_FDCWD, "/home/fusar/.claude/shell-snapshots/snapshot-bash-1776959846377-lvbzw3.sh", AT_STATX_SYNC_AS_STAT, STATX_ALL, ...) = -1 ENOENT

There is no corresponding openat(..., O_WRONLY|O_CREAT, ...) for that snapshot path anywhere in the trace. Claude logs the intent, does statx to verify, finds ENOENT (because nothing was written), and falls through without writing.

Independently verified with inotifywait -m ~/.claude/shell-snapshots/ attached during a repro: zero filesystem events over the entire Claude invocation. The binary never issues a write syscall for the snapshot file.

Since the shell snapshot appears to be a prerequisite for the Bash tool's stdout pipe plumbing, every subsequent bash call returns empty.

Ruled out

HypothesisTestResult
Corrupted installFull wipe + clean native reinstallPersists
Missing sandbox depsInstalled bubblewrap + socatNo change
Sandbox blocking stdoutAll sandbox-disable flags set; env CLAUDE_CODE_SANDBOX_DISABLED=1, DISABLE_SANDBOX=1; strace shows no execve of bwrapNo change
SELinuxgetenforce=Enforcing; ausearch -m AVC empty; setenforce 0 permissive — no changeRuled out
Managed policyNo /etc/claude-code/managed-settings.jsonRuled out
.bashrc pollutionReplaced with empty filePersists
HOME corruptionenv -i HOME=/tmp/newdir fresh dir, empty ~/.claudePersists
Disk/quota31 GB free, no user quota, manual touch in snapshots dir worksRuled out
Version regression2.1.108 and 2.1.118Both fail identically
Auth/status confirms Max OAuth, no ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN in envClean

Settings.json in use (confirmed opened + parsed via strace)

{
  "autoUpdates": false,
  "sandbox": {
    "enabled": false,
    "autoAllowBashIfSandboxed": false,
    "failIfUnavailable": false
  },
  "autoAllowBashIfSandboxed": false,
  "dangerouslyDisableSandbox": true
}

Possibly relevant (not conclusive)

Our institutional IT tested the same host with a different Anthropic account via API-key auth and reports the Bash tool works correctly. Weak signal (three variables changed at once), but combined with recent Linux OAuth-specific issues (#48079, #44092, #44930, #33811, #33879 — those manifest as 401s, not empty bash output), worth flagging that OAuth-Max-on-Linux may be involved.

Impact

Bash tool completely unusable on this host for all users on our lab's Claude Max subscriptions (5+ affected). Users see confident-sounding hallucinated output instead of real command results — actively harmful in coding/sysadmin workflows.

What Should Happen?

The Bash tool should capture stdout/stderr from executed commands and return it in the tool result, as it does on macOS and other Linux hosts. Concrete example: running echo $$ via the Bash tool should return the actual PID of the shell subprocess, not (No output).

Error Messages/Logs

From ~/.claude/debug/latest:
[DEBUG] Creating shell snapshot for bash (/bin/bash)
[DEBUG] Looking for shell config file: /home/fusar/.bashrc
[DEBUG] Creating snapshot at: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh
[DEBUG] Shell snapshot file not found after creation: /home/fusar/.claude/shell-snapshots/snapshot-bash-1776959539381-pdqbh0.sh
strace excerpt (no openat with O_CREAT|O_WRONLY for the snapshot path anywhere in the full trace):
statx(AT_FDCWD, "/home/fusar/.claude/shell-snapshots/snapshot-bash-1776959846377-lvbzw3.sh", AT_STATX_SYNC_AS_STAT, STATX_ALL, ...) = -1 ENOENT (No such file or directory)
No error messages surfaced to the user — the Bash tool result is simply "(No output)".

Steps to Reproduce

  1. On a RHEL 9 host, install Node 20:

    sudo dnf module install -y nodejs:20
  2. Install sandbox dependencies:

    sudo dnf install -y bubblewrap socat
  3. Install Claude Code:

    curl -fsSL https://claude.ai/install.sh | bash -s -- stable
  4. Authenticate with a Claude Max 20x subscription via OAuth browser flow:

    claude /login
  5. Create a minimal settings file disabling every sandbox flag:

    cat > ~/.claude/settings.json <<'EOF'
    {
      "sandbox": {"enabled": false, "autoAllowBashIfSandboxed": false, "failIfUnavailable": false},
      "dangerouslyDisableSandbox": true
    }
    EOF
  6. Run a command that requires the Bash tool and cannot be hallucinated:

    claude -p "Use the Bash tool to run: echo \$\$"
  7. Observed: tool result is (No output). Claude then hallucinates or reports "no visible output."

  8. Expected: tool result contains the numeric PID printed by the shell.

To verify the strace finding

strace -f -e trace=openat,write,unlink,rename -o /tmp/st.log \
  claude -p "Use Bash tool to run: echo hello"
grep -E "snapshot-bash.*\.sh" /tmp/st.log

Returns only statx entries with ENOENT. No openat with O_CREAT|O_WRONLY for the snapshot path is ever issued by Claude's process.

To verify no filesystem events occur at all

inotifywait -m ~/.claude/shell-snapshots/ -e create -e modify -e moved_to -e delete &
claude -p "Use Bash tool to run: echo hello"

inotifywait reports zero events during the entire Claude invocation.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

Environment

ItemValue
OSRHEL 9
Archlinux-x64
HostEPFL research server (shared, multi-user)
Filesystem for $HOMEXFS on LVM (/dev/mapper/vg1-root), rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
SELinuxEnforcing — no AVC denials during repro
Nodev20.20.2 (dnf module install nodejs:20)
bwrap/usr/bin/bwrap
socat/usr/bin/socat
Install methodnative installer from https://claude.ai/install.sh
AuthClaude Max 20x OAuth (/status confirms "Login method: Claude Max account"); no ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN in env
DISABLE_AUTOUPDATER1 — set after 2.1.108 silently upgraded to 2.1.118 within ~20 minutes despite autoUpdates: false in settings

All installs cleaned and reinstalled today following the wipe-and-reinstall procedure. Bug reproduces on all affected users. IT confirmed it is not an install corruption issue.

Timeline

Bug appeared after our institution's /home partition (where ~/.claude and the binary live) filled to 100% earlier in the week. Space has been freed (31 GB available at time of investigation). Bug persisted identically after:

  • disk freed,
  • full wipe of all Claude Code state and binaries across all affected users,
  • clean native reinstall of both stable (2.1.108) and latest (2.1.118).

Artefacts available on request

  • Full strace traces (openat/write/execve/clone filters over three repro runs)
  • ~/.claude/debug/latest with "Shell snapshot file not found" messages
  • Detailed investigation report covering every hypothesis tested, with commands and outputs

extent analysis

TL;DR

The issue can be fixed by investigating and resolving the missing write syscall for the shell snapshot file, potentially related to OAuth-Max-on-Linux authentication.

Guidance

  • Investigate the OAuth-Max-on-Linux authentication flow to see if it's causing the issue with writing the shell snapshot file.
  • Verify the permissions and ownership of the ~/.claude/shell-snapshots/ directory to ensure that the Claude Code process has write access.
  • Check the system logs for any errors or warnings related to the openat syscall or file creation in the ~/.claude/shell-snapshots/ directory.
  • Consider testing the Claude Code with a different authentication method, such as API-key auth, to see if the issue persists.

Example

No code snippet is provided as the issue seems to be related to the underlying system calls and authentication flow.

Notes

The issue appears to be specific to the RHEL 9 host and OAuth-Max-on-Linux authentication. The fact that the issue persists after a full wipe and reinstall of Claude Code suggests that it may be related to the system configuration or authentication flow.

Recommendation

Apply a workaround by testing the Claude Code with a different authentication method, such as API-key auth, to see if the issue persists. If the issue is resolved, it may indicate a problem with the OAuth-Max-on-Linux authentication flow.

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 returns empty output on RHEL 9 native Linux binary, shell snapshot never written [1 comments, 2 participants]