[BUG] Bash tool output hidden from user on non-zero exit code (model still receives it)

Resolved 💬 2 comments Opened Jun 30, 2026 by manfreed Closed Jul 4, 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 a Bash command exits non-zero, its captured output is not displayed in the terminal UI — only the command is visible together with a red dot, with no output body.

The model still receives the full stdout/stderr, so this is a display-only issue: the output is captured correctly but suppressed from the user, and Ctrl+O does not reveal it.

Behavior by case:

  • Exit code 0 (success): stdout and stderr are both rendered in the result block, as expected. The model also receives them.
  • Exit code non-zero (failure): the result block shows only the red dot + command. No stdout, no stderr, no error body. Ctrl+O does not expand it. (one empty line is expanded). The model states that it sees the output wrapped in an <error> block.
  • In both cases, the model confirms it received the full stdout + stderr. The difference is purely in what the terminal displays to the user — and it is gated on the exit code.

What Should Happen?

Output from a failed command should be visible to the user, the same way it is for a successful command — or, at minimum, expandable via Ctrl+O.

Error Messages/Logs

Steps to Reproduce

Create a script that writes to both streams and takes the exit code as an argument:

#!/usr/bin/env bash
echo "this is stdout"
echo "this is stderr" >&2
exit "${1:-0}"

Then have Claude run them separately:

./test.sh 0   # output is displayed
./test.sh 1   # output is hidden — only red dot + command shown

Ask Claude what the command printed in each case — it can quote the output back for the failed run, confirming the data was captured but not shown.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.196 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

  • Terminal: Ghostty, but also happened in VSCode Terminal, I don't think it's terminal-specific.

Related issues (distinct from this one)

  • #26954 — Ctrl+O/Ctrl+E don't expand truncated output. Related rendering bug, but gated on output size, not exit code.
  • #19663 / #18748 / #36915 — (No content) reports. These are capture failures (the model gets nothing) and are platform-specific. This issue is the inverse: capture works, display doesn't.

Note

The model reports that the failed-command result appears to be wrapped in an error block on its side, which may be why it renders differently. Treat that as a hypothesis about the mechanism rather than a confirmed internal detail.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗