[BUG] Bash tool: stdout not captured, exit code 1 on Linux
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?
All Bash tool commands that produce stdout fail with exit code 1 and no output is returned. However, commands that redirect stdout to a file execute successfully — proving
the commands themselves work fine, but stdout capture is broken.
This applies to all commands: echo, whoami, pwd, cat, ls, etc. Commands like echo "hello" > file.txt succeed (exit 0), and reading the file confirms the output
was written correctly.
This happens regardless of shell: tested with fish, bash, and sh via CLAUDE_CODE_SHELL. Also persists with --dangerously-skip-permissions. No hooks are configured.
What Should Happen?
echo "hello world" should return exit code 0 with "hello world" on stdout, as it did in previous versions.
Error Messages/Logs
● Bash(echo "hello world")
⎿ Error: Exit code 1
● Bash(whoami)
⎿ Error: Exit code 1
● Bash(echo "hello" > /tmp/test.txt) ← this works, exit 0
● Read(/tmp/test.txt) → "hello" ← confirms command executed
Steps to Reproduce
- Install Claude Code v2.1.63
- Run
claude(default shell: fish, but reproducible with any shell) - Ask Claude to run
echo "hello world"via the Bash tool - Observe: exit code 1, no output
- Ask Claude to run
echo "hello world" > /tmp/test.txt - Observe: exit code 0, file contains "hello world"
Workarounds attempted (all still fail):
- CLAUDE_CODE_SHELL=/bin/bash claude
- CLAUDE_CODE_SHELL=/bin/sh claude
- CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 claude --dangerously-skip-permissions
- No hooks configured, settings.json is empty ({})
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.63
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Possibly related to #26482 (same symptom on Cygwin) and #27623
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗