Claude Code CLI Bug Report: Bash Tool Returns No Output on macOS 26

Open 💬 24 comments Opened Jan 21, 2026 by randykerber

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?

Claude Code CLI Bug Report: Bash Tool Returns No Output on macOS 26

Summary

Claude Code CLI's Bash tool returns "(No content)" for all commands on macOS 26.2, but the same Bash tool works perfectly in Claude Desktop on the same machine.

Environment

Platform:

  • macOS 26.2 (Build 25C56)
  • Darwin 25.2.0
  • Mac Studio M4 Max, 64GB RAM

Claude Code Version: 2.1.14

Terminals Tested:

  • Warp
  • Terminal.app

Shell: zsh (SHELL=/bin/zsh)

Issue Description

When running Claude Code via CLI (claude command in terminal), all Bash tool commands return "(No content)" with no stdout or stderr captured. However, the exact same Bash tool works perfectly when using Claude Code through Claude Desktop app.

CLI (BROKEN) - Example Output

❯ Run: echo "test"

⏺ Bash(echo "test")
  ⎿  (No content)

Desktop (WORKS) - Same Command

Run: echo "test"

Ran 1 command
Done:

Echo: test

Key Finding: CLI vs Desktop

Same machine, same OS, same version - different results:

| Environment | Bash Output | Status |
|------------|-------------|--------|
| Claude Code CLI | (No content) | ❌ Broken |
| Claude Desktop (Claude Code feature) | Output displayed | ✅ Works |

This strongly suggests the issue is specific to how the CLI handles subprocess stdio in terminal environments on macOS 26, not a fundamental Bash tool problem.

Installation History

Claude Code was installed via npm initially (through fnm), then tested with Homebrew installation. Both methods show identical broken behavior in CLI.

Most recent npm install: 2026-01-20 18:18 (version 2.1.14)

System Checks

Node/npm Environment (when using npm):

  • Node via fnm with multishells
  • Path: /Users/rk/.local/state/fnm_multishells/[session]/bin/node

Homebrew Installation:

  • Binary: /opt/homebrew/bin/claude
  • Completely outside npm/fnm environment

Both installations broken identically in CLI.

Debug Log Excerpt

From ~/.claude/debug/*.txt:

[DEBUG] executePreToolHooks called for tool: Bash
[DEBUG] Getting matching hook commands for PreToolUse with query: Bash
[DEBUG] Found 0 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)

No errors in logs - commands appear to execute, but output is never captured.

Expected Behavior

Bash commands should return stdout/stderr output like they do in Claude Desktop.

Actual Behavior

All Bash commands return "(No content)" in CLI.

Workarounds

  1. Use Claude Desktop's Claude Code feature (works perfectly)
  2. Use file-based tools (Read/Write/Edit/Glob/Grep) which work fine
  3. Run bash commands manually in terminal

Impact

  • CLI is effectively broken for any workflow requiring bash command execution
  • Users must switch to Claude Desktop or manually run all bash commands
  • Critical for CI/CD, scripting, git operations, builds, tests

Additional Context

Issue was discovered during extensive debugging session on 2026-01-20. Multiple hypotheses tested:

  • Shell configuration interference (ruled out)
  • fnm/npm environment issues (ruled out - Homebrew install same)
  • macOS 26 incompatibility (ruled out - Desktop works)
  • Version regression (ruled out - all versions broken)

The CLI-vs-Desktop difference is the smoking gun: this is a terminal stdio capture issue in the CLI implementation on macOS 26.

Related Issues

  • #12998 - Bash commands freeze with no output
  • #12115 - Bash commands fail with no output

Request

This is a critical bug affecting macOS 26 users of Claude Code CLI. Desktop workaround exists but CLI should be fixed.

Suggested investigation areas:

  • How CLI spawns subprocess vs Desktop
  • Terminal stdio file descriptor handling on macOS 26
  • Differences in Electron (Desktop) vs Node.js (CLI) subprocess spawning

---

Reporter: Randy Kerber
Date: 2026-01-20
Contact: (add if desired)

What Should Happen?

Should run as it does in 'Code' tab in Claude Desktop:

Run: echo "test with claude code in claude desktop"
Run: pwd
Run: date

I'll run those three commands for you.

Ran 3 commands
Done:

Echo: test with claude code in claude desktop
Working directory: /Users/rk/tmp
Date: Tue Jan 20 23:26:37 MST 2026
To confirm, those 'Bash(...)' commands produced output?

Yes, all three commands ran successfully and produced output:

echo → test with claude code in claude desktop
pwd → /Users/rk/tmp
date → Tue Jan 20 23:26:37 MST 2026
Everything worked as expected.

Error Messages/Logs

❯   Run: echo "test with homebrew install"                                                                              
                                                                                                                        
  Run: pwd                                                                                                              
                                                                                                                        
  Run: date                                                                                                             
                                                                                                                        
⏺ I'll run those three commands for you.                                                                                
                                                                                                                        
⏺ Bash(echo "test with homebrew install")                                                                               
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ Bash(pwd)                                                                                                             
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ Bash(date)                                                                                                            
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ The commands ran but produced no output, which is unusual for pwd and date. Let me try again with a combined command  
  to see if there's an output issue.                                                                                    
                                                                                                                        
⏺ Bash(echo "test with homebrew install" && pwd && date)                                                                
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ This is unusual - the commands should produce output. Let me try writing to a file and reading it back to verify      
  execution.                                                                                                            
                                                                                                                        
⏺ Bash((echo "test with homebrew install" && pwd && date) > /tmp/claude/test_output.txt)                                
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ Read(/tmp/claude/test_output.txt)                                                                                     
  ⎿  Error reading file                                                                                                 
                                                                                                                        
⏺ Bash(ls -la /tmp/claude/ 2>&1)                                                                                        
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ There appears to be an issue with command output. Let me try with the sandbox disabled to see if that's the cause.    
                                                                                                                        
⏺ Bash(echo "test with homebrew install" && pwd && date)                                                                
  ⎿  (No content)                                                                                                       
                                                                                                                        
⏺ I'm encountering an unusual issue where bash commands are executing without errors, but producing no output. Even     
  simple commands like echo, pwd, and date that should always produce output are returning nothing.                     
                                                                                                                        
  This appears to be a system-level issue with how command output is being captured. The commands you requested are:    
                                                                                                                        
  1. echo "test with homebrew install" - Should print "test with homebrew install"                                      
  2. pwd - Should print the current working directory (/Users/rk based on your environment)                             
  3. date - Should print the current system date and time                                                               
                                                                                                                        
  All three executed without errors, but the output isn't being displayed. This might be a configuration issue with the 
  Bash tool or the environment. Would you like me to try a different approach or investigate further?

Steps to Reproduce

Reproduction Steps

CLI Test (Fails)

  1. Open Terminal.app or Warp
  2. Run: claude
  3. Execute: Run: echo "test"
  4. Result: "(No content)"

Desktop Test (Works)

  1. Open Claude Desktop app
  2. Use Claude Code feature
  3. Execute: Run: echo "test"
  4. Result: Output displays correctly

Extensive Diagnostics Performed

✅ Bash Works Directly in Terminal

/bin/bash -c "echo test"        # ✅ Works
/bin/bash --noprofile --norc -c "echo test"  # ✅ Works

✅ Tested with Zero Shell Init Files

Renamed all shell init files (.bashrc, .bash_profile, .zshrc, .zshenv, .zprofile) to completely clean environment - issue persists.

✅ SHELL Environment Variable Correct

echo $SHELL
# /bin/zsh (correct absolute path, not /usr/bin/env)

✅ Tested Multiple Claude Code Versions

All versions show same issue:

  • 2.0.76
  • 2.1.11
  • 2.1.12
  • 2.1.14

✅ Tested Multiple Installation Methods

  • npm install (broken)
  • Homebrew cask (broken)
  • Both show identical behavior

✅ Tested with Sandbox Disabled

/sandbox

No change - still broken.

✅ Tested in Multiple Terminals

  • Warp: Broken
  • Terminal.app: Broken

✅ File Tools Work Perfectly

  • Read tool: ✅ Works
  • Write tool: ✅ Works
  • Edit tool: ✅ Works
  • Glob tool: ✅ Works
  • Grep tool: ✅ Works

Only Bash tool is affected.

Test Commands That Fail

All return "(No content)":

echo "test"
pwd
date
ls
whoami

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.14

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Selected model is '4. Opus Plan Mode (Opus 4.5 / Sonnet)'

View original on GitHub ↗

24 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/18856
  2. https://github.com/anthropics/claude-code/issues/18486
  3. https://github.com/anthropics/claude-code/issues/12998

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

randykerber · 5 months ago

## POSSIBLE ROOT CAUSE IDENTIFIED

After further debugging with Claude Code...

The bash snapshots contain set -o onecmd which causes bash to exit after
executing one command. This breaks Claude Code's wrapper script that needs
to execute multiple commands (source snapshot, source env-setup.sh, run
user command).

Evidence:
```bash
$ grep "^set -o onecmd" ~/.claude/shell-snapshots/snapshot-bash-*.sh
set -o onecmd

This matches the root cause identified in #18856 for Windows, but also
affects macOS (and likely Linux per #18486).

Impact: Wrapper script execution is interrupted, causing either:

  • "(No content)" - output capture fails
  • "line 40: syntax error: unexpected end of file" - incomplete script

This is a CRITICAL bug affecting all platforms in v2.1.x series.
```
related issue: Issue 18856

randykerber · 5 months ago

## CRITICAL FINDING: Issue is likely in Wrapper Execution, Not Snapshots

Both Claude Desktop AND standalone CC create snapshots with set -o onecmd.
However:

  • ✅ Claude Code inside Claude Desktop -- Bash() commands work perfectly
  • ❌ Standalone Claude Code -- bash commands fail
randykerber · 5 months ago

Problem still present in v2.1.19:

cd ~/tmp
claude
                                                                                                                                                                                                                 
 ▐▛███▜▌   Claude Code v2.1.19                                                                                                                                                                                   
▝▜█████▛▘  Sonnet 4.5 · Claude Max                                                                                                                                                                               
  ▘▘ ▝▝    ~/tmp                                                                                                                                                                                                 
                                                                                                                                                                                                                 
❯ Run: echo "test if Bash() returns output, or still broken"                                                                                                                                                     
                                                                                                                                                                                                                 
⏺ I'll run that test command for you.                                                                                                                                                                            
                                                                                                                                                                                                                 
⏺ Bash(echo "test if Bash() returns output, or still broken")                                                                                                                                                    
  ⎿  (No content)                                                                                                                                                                                                
                                                                                                                                                                                                                 
⏺ The Bash tool executed the command but returned "Tool ran without output or errors" - which suggests the issue you're testing for is present. The echo command should have produced output ("test if Bash()    
  returns output, or still broken"), but that output wasn't captured or returned.                                                                                                                                
                                                                                                                                                                                                                 
  This indicates the Bash tool may not be properly capturing stdout from commands.    
randykerber · 5 months ago

Default shell is zsh. Setting SHELL to bash does not fix, results in different error:

~/tmp

% SHELL=/bin/bash claude
                                                                                                                                                                                                                 
 ▐▛███▜▌   Claude Code v2.1.19                                                                                                                                                                                   
▝▜█████▛▘  Sonnet 4.5 · Claude Max                                                                                                                                                                               
  ▘▘ ▝▝    ~/tmp                                                                                                                                                                                                 
                                                                                                                                                                                                                 
❯ Run with Bash tool:    echo "test if Bash() returns output, or still broken"                                                                                                                                   
                                                                                                                                                                                                                 
⏺ I'll run that test command for you.                                                                                                                                                                            
                                                                                                                                                                                                                 
⏺ Bash(echo "test if Bash() returns output, or still broken")                                                                                                                                                    
  ⎿  Error: Exit code 2                                                                                                                                                                                          
     /bin/bash: -c: line 40: syntax error: unexpected end of file                                                                                                                                                
                                                                                                                                                                                                                 
⏺ The Bash tool appears to have an issue - it's returning a syntax error for a simple echo command. Let me try a different approach:                                                                             
                                                                                                                                                                                                                 
⏺ Bash(echo test output)                                                                                                                                                                                         
  ⎿  Error: Exit code 2                                                                                                                                                                                          
     /bin/bash: -c: line 40: syntax error: unexpected end of file                                                                                                                                                
                                                                                                                                                                                                                 
⏺ Still getting the same syntax error. Let me try an even simpler command:                                                                                                                                       
                                                                                                                                                                                                                 
⏺ Bash(pwd)                                                                                                                                                                                                      
  ⎿  Error: Exit code 2                                                                                                                                                                                          
     /bin/bash: -c: line 40: syntax error: unexpected end of file                                                                                                                                                
                                                                                                                                                                                                                 
⏺ The Bash tool is broken.                                                                                                                                                                                       
                                                                                                                                                                                                                 
  Every command, even the simplest ones like pwd, is returning the same error:                                                                                                                                   
                                                                                                                                                                                                                 
  Exit code 2                                                                                                                                                                                                    
  /bin/bash: -c: line 40: syntax error: unexpected end of file                                                                                                                                                   
                                                                                                                                                                                                                 
  The "line 40" in the error suggests the tool is internally constructing a multi-line script, and something in that construction process has a syntax error (likely an unclosed quote, heredoc, or similar).    
  This is affecting all Bash commands regardless of complexity.                                                                                                                                                  
                                                                                                                                                                                                                 
  This appears to be an infrastructure issue with the Bash tool itself, not something I can work around. You may want to report this at https://github.com/anthropics/claude-code/issues.       
j-greig · 5 months ago

I hae the same problem, also zsh shell, running CC v2.1.20 on macos 15.3... and it's driving me crazy... even a full uninstall and reinstall hasn't fixed the issue. File-based tools (Read, Grep, Glob, Edit) are unaffected.

gloeglm · 5 months ago

Can confirm this - I have tried a few Claude Code versions on MacOS 26.2 (25C56)
I have also tried switching the SHELL environment variable, no change.
Also "Explore" seems to get stuck, probably because it uses the Bash tool interenally

j-greig · 5 months ago

This is infuriating, I don't want to downgrade the installed version but there is no other option it seems.

caozhiyuan · 5 months ago

also in windows.
$ set -o | grep "on" | awk '{print "set -o " $1}' | head -n 1000
set -o braceexpand
set -o emacs
set -o hashall
set -o histexpand
set -o history
set -o interactive-comments
set -o monitor
set -o onecmd

should remove set -o onecmd

j-greig · 5 months ago

emptying ~/.claude/shell-snapshots/ seems to make some bash commands work again for me on macos but still missing some basic commands...

Claude Code v2.1.23 Bash Tool - Partial Fix Report

  Environment: macOS 14.3, Apple Silicon, zsh

  Fix applied: Deleted ~/.claude/shell-snapshots/ + minimal .zshrc with early return
  for non-interactive shells

  Working
  ┌────────────────────────────┬────────┐
  │          Command           │ Status │
  ├────────────────────────────┼────────┤
  │ echo "test"                │ ✅     │
  ├────────────────────────────┼────────┤
  │ date                       │ ✅     │
  ├────────────────────────────┼────────┤
  │ pwd                        │ ✅     │
  ├────────────────────────────┼────────┤
  │ whoami                     │ ✅     │
  ├────────────────────────────┼────────┤
  │ node --version             │ ✅     │
  ├────────────────────────────┼────────┤
  │ /bin/ls                    │ ✅     │
  ├────────────────────────────┼────────┤
  │ /usr/bin/uname -a          │ ✅     │
  ├────────────────────────────┼────────┤
  │ /usr/bin/python3 --version │ ✅     │
  ├────────────────────────────┼────────┤
  │ command ls                 │ ✅     │
  ├────────────────────────────┼────────┤
  │ /bin/ls | /usr/bin/head -3 │ ✅     │
  └────────────────────────────┴────────┘
  Failing
  ┌───────────────────┬───────────┐
  │      Command      │  Result   │
  ├───────────────────┼───────────┤
  │ ls                │ Exit 1    │
  ├───────────────────┼───────────┤
  │ uname -a          │ Exit 1    │
  ├───────────────────┼───────────┤
  │ ls | head -3      │ Exit 1    │
  ├───────────────────┼───────────┤
  │ python3 --version │ No output │
  ├───────────────────┼───────────┤
  │ which python3     │ No output │
  ├───────────────────┼───────────┤
  │ type ls           │ No output │
  ├───────────────────┼───────────┤
  │ alias             │ No output │
  └───────────────────┴───────────┘
  Pattern

  Commands work with full paths (/bin/ls) or command prefix (command ls), but fail when
   relying on PATH resolution or shell builtins. Suggests wrapper script or PATH issue
  in Claude Code's shell execution.
````
linsy89 · 5 months ago

Additional Confirmation: Bug Affects BOTH CLI and Desktop on macOS

Environment

  • macOS Version: 14.7.4
  • Claude Code CLI Versions Tested: 1.0.119, 2.0.76, 2.1.31 (latest)
  • Claude Desktop Version: 1.1.1890 (with built-in Claude Code 2.1.30)
  • Shell: bash
  • Node.js: v22.18.0

Critical Finding: Desktop Also Affected

Unlike the original issue report which stated Desktop works fine, I can confirm that Claude Desktop's Code feature also exhibits the same bug on my system.

CLI Reproduction
❯ Run: echo "test"
⏺ Bash(echo "test")
  ⎿  (No content)

❯ Run: pwd
⏺ Bash(pwd)
  ⎿  (No content)
Desktop Reproduction

Same commands in Claude Desktop's Code mode:

⏺ Bash(echo "test")
  ⎿  (No content)

⏺ Bash(pwd)
  ⎿  (No content)

Both CLI and Desktop return "(No content)" for all bash commands.

Troubleshooting Attempted

✅ Complete uninstall and reinstall of CLI (both npm and native)
✅ Removed ALL Claude-related files:

  • ~/.claude (CLI working directory)
  • ~/.claude-worktrees (git worktree configs)
  • ~/Library/Application Support/Claude/claude-code (Desktop's built-in binary)
  • All caches and temp files

✅ Cleaned corrupted git worktree configurations
✅ Deleted ~/.claude/shell-snapshots/ (community workaround)
✅ Tested CLI versions: 1.0.119, 2.0.76, 2.1.31
✅ Deleted and let Desktop re-download claude-code component
None of these resolved the issue

Version Downgrade Results

CLI versions tested (all exhibit same bug):

  • 1.0.119 → (No content)
  • 2.0.76 → (No content)
  • 2.1.31 → (No content)

Desktop versions:

  • Built-in Claude Code 2.1.30 → (No content)

The bug exists across all available versions and both delivery methods (CLI and Desktop).

Impact

This completely blocks the core bash execution functionality:

  • ❌ Cannot run scripts
  • ❌ Cannot execute git commands
  • ❌ Cannot perform file operations
  • ❌ Cannot run tests or validations
  • ❌ Cannot use any command-line tools

Both Claude Code CLI and Claude Desktop's Code feature are essentially unusable for development workflows on macOS.

Divergence from Original Report

The original issue stated:

"the same Bash tool works perfectly in Claude Desktop app"

However, in my environment, Desktop is also broken, suggesting this may be a broader macOS stdio capture issue affecting both Electron (Desktop) and Node.js (CLI) environments under certain macOS configurations.

Request

This bug has been open for 2 weeks (since Jan 21, 2026) and severely impacts productivity. Could the team please:

  1. Prioritize this fix - it blocks all bash functionality
  2. Provide an ETA for resolution
  3. Investigate why Desktop is also affected in some environments
  4. Share any official workarounds if available

This is a critical blocker for professional development workflows. Thank you for your attention.

randykerber · 5 months ago

@linsy89 -- Thanks for the very thorough followup confirmation of this critical issue.

Yes, I am still severely handicapped by this definite cripplilng bug.

Anthropic -- please take this seriously. This is not a minor annoyance, it is a serious deficiency, not limited to Mac, referenced by multiple people in multiple other GitHub issues.

j-greig · 5 months ago

Had to reinstall macos to fix this on my machine :(
But at least CC is working again now :)

segunjkf · 5 months ago

i have the same issue but SHELL=/bin/bash claude —resume seems to fix it for me

ugattupalli-coatue · 4 months ago

Having the same issue.

I uninstalled and reinstalled Claude. Tried the native installation and also through Homebrew.

Facing this on v2.1.49 and been an issue since v2.1.30. I'm on MacOS 15.7.3 on MBP M1Pro

ccheath · 4 months ago

found my issue... it was in the .bashrc file

● Found the issue. In your .bashrc at lines 6-11:                                                   
                                                                                                    
  if [[ -z "$SKIP_INTERACTIVE_CHECK" ]]; then                                                       
      case $- in                                                                                    
          *i*) ;;                                                                                   
            *) exit;;   # <-- this is the problem                                                   
      esac                                                                                        
  fi                                                                                                
                                                                                                    
  When Claude Code spawns a bash shell to run commands, it's non-interactive, so this code calls    
  exit — which kills the shell before any command output can be produced. The fix is to use return  
  instead of exit. Using return just stops sourcing the file without killing the parent shell       
  process.

● Update(~/.bashrc)                                                                                 
  ⎿  Added 1 line, removed 1 line
       6  if [[ -z "$SKIP_INTERACTIVE_CHECK" ]]; then                                               
       7      case $- in                                                                            
       8          *i*) ;;                                                                           
       9 -          *) exit;;                                                                       
       9 +          *) return;;                                                                     
      10      esac                                                                                  
      11  fi                                                                                        
      12                                                                                            
                                                                                                    
● Now let's verify the fix works:                                                                   
                                                                                                    
● Bash(echo "test")                                                                                 
  ⎿  test                                                                                           
dr0uleau · 4 months ago

Root Cause Found: Heavy statusLine command causes "(No output)"

After extensive debugging (source code analysis, process tracing, timing instrumentation), I found that a heavy statusLine script is the root cause of intermittent "(No output)" from the Bash tool on macOS.

The problem

My statusLine script ran claude mcp list, multiple git commands, and jq on every UI refresh. This spawned additional bash processes (~1.5s each) that competed with the Bash tool's output capture in the event loop. Commands taking >0.5-0.8s before producing output would silently return empty.

How I confirmed it

I added timing instrumentation via BASH_ENV and discovered that every Bash tool call spawned 2+ bash processes — the actual command plus the statusline script. The combined execution pushed past internal timing thresholds, causing output to be lost.

Setting the statusline to echo '' (no-op) immediately fixed everything — sleep 5 && echo test, gh pr list, parallel bash calls all work 100%.

The fix

Replaced the heavy statusline with a lightweight version:

  • Removed: claude mcp list (spawns a full Claude Code subprocess, ~1.5s)
  • Removed: per-file wc -l loop on untracked files
  • Kept: jq on stdin JSON, git branch --show-current, git diff HEAD --numstat (all fast)

Recommendation for Claude Code

The statusline command should probably run in a way that doesn't contend with Bash tool output capture — either:

  1. Run statusline updates asynchronously, decoupled from the tool execution event loop
  2. Document that statusline scripts should be lightweight (<100ms)
  3. Add a warning if a statusline command takes >500ms
cyf1997 · 4 months ago

I'm having the same issue in Windows 11.

<img width="1113" height="626" alt="Image" src="https://github.com/user-attachments/assets/843d2ac6-0f2c-49b2-b879-55f5ed442cb8" />

cyf1997 · 4 months ago
我在Windows 11系统上也遇到了同样的问题。 <img alt="图像" width="1113" height="626" src="https://private-user-images.githubusercontent.com/88784871/562660373-843d2ac6-0f2c-49b2-b879-55f5ed442cb8.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzMzNjk5OTEsIm5iZiI6MTc3MzM2OTY5MSwicGF0aCI6Ii84ODc4NDg3MS81NjI2NjAzNzMtODQzZDJhYzYtMGYyYy00OWIyLWI4NzktNTVmNWVkNDQyY2I4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzEzVDAyNDEzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThhOGQ5MmEyYWU1MDJkYjQ5ZTUwYjUxMDIwZjE0YzY2OWU2MjBhMGY3NGJhMWU3MGJlMjdmNWNlMTU4MDE5ZjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.fJU6TWMwylwMTCyIzn4fQLDSL3pKkofsDhoMXDDey6o">

I've fixed it. The issue was that I had misconfigured the environment variable CLAUDE_CODE_GIT_BASH_PATH. It should point to /bin/bash.exe inside the Git installation directory, not the outer git-bash.exe.

kutzki · 3 months ago

Having the same issues on Windows

cantecim · 3 months ago

I had the same issue (#40977)

SHELL=/bin/bash gave another error

!echo a
/bin/bash: -c: line 1: syntax error: unexpected end of file

Then I realized I have an empty skeleton env file pointed to by CLAUDE_ENV_FILE, unsetting that or adding something to the file fixed my issue

tanya-gencheva · 3 months ago

Resolution: CLAUDE_ENV_FILE environment variable causes silent Bash tool failure

I hit this same issue — Bash tool returning empty output for every command, no stdout, no stderr. macOS (Darwin 24.6.0), zsh, Claude Code 2.1.70+.

Root cause

I had this in my ~/.zshrc:

export CLAUDE_ENV_FILE="$HOME/unify/.claude/secrets.local.sh"

This was meant to inject environment variables (API keys, etc.) into the Claude Code session. However, it appears that Claude Code's handling of the CLAUDE_ENV_FILE variable interferes with subprocess stdio, causing the Bash tool to silently swallow all output.

Fix

Remove the CLAUDE_ENV_FILE export and source the file directly instead:

- export CLAUDE_ENV_FILE="$HOME/unify/.claude/secrets.local.sh"
+ source "$HOME/unify/.claude/secrets.local.sh"

The environment variables still get loaded into the shell session (and are available to Claude Code), but without triggering whatever internal processing CLAUDE_ENV_FILE does that breaks output capture.

Symptoms before fix

  • All Bash tool commands returned empty / "(No content)"
  • No errors, no stderr — completely silent failure
  • Intermittent across sessions (sometimes worked, sometimes didn't)
  • Write tool, Read tool, etc. all worked fine — only Bash was affected

Hope this helps anyone else hitting the same wall.

litujia1007 · 1 month ago

Confirming this on macOS 26.0.1 (build 25A362) with Claude Code 2.1.177 (CLI) — and flagging a downstream effect that I think matters more than the missing output itself.

Environment

  • macOS 26.0.1 (25A362), Apple Silicon
  • Claude Code 2.1.177 (CLI in a terminal, latest at time of writing)
  • zsh

Same core symptom: the Bash tool intermittently returns empty output (no stdout/stderr) even though the command actually executed.

Two things to add to the original report:

1. It's intermittent here, not 100%. Most Bash calls return output normally; only a fraction come back empty. That's arguably worse than a hard failure, because it's unpredictable and easy to miss.

2. The empty output induces the model to fabricate. This is the part worth highlighting. When the model receives an empty tool result on a step it expects to succeed, it tends to fill the gap with a prior — i.e. it hallucinates a plausible "success" output and keeps going. In one ~23-minute end-to-end session this cascaded: the model invented worktree-creation, env-setup, and install-success output that never happened, then built a fully self-consistent but entirely fictional result on top of it. The same failure mode (filling missing signal with a prior) also made it "detect and refuse" a prompt-injection that did not exist in any input.

So the impact isn't just "I can't see the output" — it's that the agent can silently produce confident, fabricated conclusions from a command that returned nothing.

Local mitigation (doesn't fix the root cause, just contains the blast radius): a PostToolUse hook on Bash that detects empty stdout+stderr and injects a reminder telling the model not to assume success, and to re-verify real state with an independent command before continuing. Helpful as a stopgap, but the underlying stdio-capture bug clearly needs a real fix.

Happy to provide debug logs if useful.