[BUG] Bash tool command preview shows never-executed error strings, confusing users
Resolved 💬 2 comments Opened Apr 2, 2026 by mvanhorn Closed May 10, 2026
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?
When Claude Code displays a Bash tool call in the TUI, it shows the full command text including never-executed branches. This causes users to misread fallback error strings as actual errors.
For example, this command:
which gh >/dev/null 2>&1 && echo "gh installed" || echo "ERROR: GitHub CLI not installed"
gh auth status 2>&1 | head -3 || true
Displays in the TUI as:
⏺ Bash(which gh >/dev/null 2>&1 && echo "gh installed" || echo "ERROR: GitHub CLI not installed"
gh auth status 2>&1 | head -3 || true)
⎿ gh installed
github.com
✓ Logged in to github.com account mvanhorn (keyring)
- Active account: true
The string ERROR: GitHub CLI not installed appears prominently in the command preview even though:
ghIS installed- The success path ran (
gh installedwas the actual output) - The error string never executed
A user scanning the output naturally reads "ERROR: GitHub CLI not installed" and thinks something went wrong.
What Should Happen Instead?
The command and its output should be visually distinct enough that users can tell what actually ran vs. what was just part of the command text. Some options:
- Stronger visual separation between the command and its output (e.g., a divider line, dimmed command text, or collapsible command block)
- Truncate or collapse long inline conditionals in the command preview
- Show only the description field (when provided) in the collapsed view, with the full command expandable
Steps to Reproduce
- Open Claude Code
- Have it run any bash command with an
||fallback that includes an error-like string - Observe that the error string appears in the command preview regardless of which branch executed
Environment
- macOS
- Claude Code CLI (latest)
- Terminal: iTerm2
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗