[BUG] Bash tool: large-output truncation preview shows stale/unrelated content instead of the actual command output

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 25, 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?

What's Wrong

When a Bash tool call's output exceeds the size threshold that triggers the
"Output too large" truncation behavior, the inline preview block is supposed
to show the first ~2KB of the actual command output (with a note that the
full output was saved to a persisted-output file). Instead, on several
consecutive calls in one session, the preview showed a stale, unrelated
ls -la directory listing of the project root — not the output of the
command that was actually run.

The persisted-output file itself was correct: reading it directly (via the
Read tool) returned the real, expected output of each command. So the data
was captured correctly; only the inline preview shown alongside the
truncation notice was wrong. This resolved on its own later in the same
session without any explicit fix.

What Should Happen?

What Should Happen

The "Preview (first 2KB)" shown inline should always be the first ~2KB of the
actual stdout/stderr produced by the command that was just run, never
unrelated or cached content from an earlier or different command.

Error Messages/Logs

## Error Messages/Logs
Truncation notice format observed:
Output too large (30.7KB). Full output saved to: <session-path>/tool-results/<id>.txt
Preview (first 2KB):
total 15824
drwxr-xr-x   390 dale.courtney  staff   12480 Jul 24 12:14 .
drwxr-x---@   86 dale.courtney  staff    2752 Jul 25 05:47 ..
-rw-r--r--@    1 dale.courtney  staff   57348 Jul 24 05:38 .DS_Store
drwxr-xr-x@    3 dale.courtney  staff      96 Jul 24 13:59 .claude
... (full `ls -la`-style directory listing of the repo root, unrelated to the
git command actually executed)
Reading the same persisted-output file directly at its tail returned the
correct expected content, e.g. for a `git push` call:
To https://gitlab.economicmodeling.com/ltc/it/python-scripts.git
   0fa5e158..adca84f8  main -> main
Environment:
- Working directory: /Users/dale.courtney/scripts
- Platform: macOS (Darwin 25.5.0), zsh
- Claude Code CLI (non-interactive/agent SDK session)

Steps to Reproduce

Steps to Reproduce

  1. In a git repo, run a sequence of git commands whose output exceeds the

large-output threshold, e.g.:

  • git status -sb
  • git diff --stat ...
  • git commit -m "..."
  • git push <remote> main
  1. Several of these calls return a truncation notice:

Output too large (XX.XKB). Full output saved to: <path>
followed by a "Preview (first 2KB)" section.

  1. Observe that the preview section shows an ls -la-style directory listing

of the repo root (file permissions, sizes, timestamps, filenames) instead
of output related to the command that was run.

  1. Read the persisted-output file directly (at or near its tail) and confirm

it contains the correct, expected command output — showing the underlying
data was captured correctly and only the inline preview was wrong.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude 1.24012.9 (03c61d) 2026-07-24T04:59:17.000Z

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗