[BUG] Bash tool incorrectly reports "Error" for normal non-zero exit codes
Resolved 💬 3 comments Opened Aug 18, 2025 by benjaminjackson Closed Aug 22, 2025
Environment
- Platform (select one): Anthropic API
- Claude CLI version: 1.0.83 (Claude Code)
- Operating System: macOS (Darwin 22.6.0)
- Terminal: Terminal App
Bug Description
The Bash tool incorrectly reports <error>Error</error> for any command that exits with a non-zero status code, even when the non-zero exit represents normal program behavior rather than an actual error.
Steps to Reproduce
- Prompt Claude Code to run any command via the Bash tool that normally exits with code 1 for "no results" or similar normal conditions
- Examples:
grep "nonexistent_term" some_file.txtfalse
- Observe the tool result shows <error>Error</error>
- Compare with commands that exit 0: true shows <system>Tool ran without output or errors</system>
- Examples:
grep "existent_term" some_file.txttrue
Expected Behavior
The Bash tool should distinguish between:
- Actual errors: Command not found, permission denied, syntax errors, etc. → Show as error
- Normal non-zero exits: No matches found, logical false conditions, files differ, etc. → Show as normal completion with no output
Many Unix tools use exit codes semantically where non-zero doesn't indicate failure.
Actual Behavior
The Bash tool shows <error>Error</error> for any non-zero exit code, making it impossible to distinguish between actual command failures and normal program behavior.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗