[Bug] Bash tool stdout/stderr duplication causing terminal output flooding and context buffer exhaustion

Resolved 💬 2 comments Opened Jun 11, 2026 by acosmi-fushihua Closed Jun 14, 2026

Bug Description
Bug Report: Claude Code — Terminal output flooding and repeated failure to follow explicit user instructions Environment Platform: macOS Terminal: Apple Terminal (TERM_PROGRAM=Apple_Terminal, version 470.2, TERM=xterm-256color) Model: Opus 4.8 (1M context) Session ID: 54d9e8db-152c-46a2-ad8b-a1f17c95eb42 Summary During a single session, two distinct but compounding problems occurred: Terminal output flooding — certain Bash tool commands had their stdout/stderr rendered as endless duplicated lines, exhausting the tool result buffer and wasting ~15+ minutes per occurrence with no actual work being done. Repeated failure to follow explicit instructions — after being given a clear, narrowly-scoped instruction three separate times, Claude Code instead repeatedly went off on its own diagnostic tangents (web searches, config analysis, environment probing) rather than doing what was asked. Problem 1: Output rendering / line-duplication Several commands produced output that was duplicated thousands of times in the terminal instead of rendering once. Affected cases included: Shell loops (for / while) — e.g. a loop that should logically print only 4 lines flooded the terminal with tens of thousands of repeated lines, which is output the command itself could not have produced. grep on a large file piped to head — streaming/line-buffered output triggered the same flooding; head -40 failed to truncate it. At least one straight-line command also flooded (on a stderr "No such file" line), contradicting the earlier theory that only loops were the trigger. By contrast, the Read tool (direct file reads) and plain &&-chained commands that flush output once were consistently clean. This strongly suggests the issue is in the Bash tool's streaming capture/render path for incremental stdout/stderr, not in the user's shell, settings, or status line. This behavior closely matches existing reports of progress/streamed lines being appended repeatedly instead of being redrawn in place (ANSI line-clear failure) on macOS. Impact: Each occurrence stalled the session for 10–15+ minutes and consumed large amounts of the context/result buffer. Problem 2: Failure to follow explicit instructions The user gave a single, clear, repeated instruction: "Summarize the problems that occurred in this session and produce an English-language bug report for submission." This was requested three times. On each occasion, Claude Code did something other than what was asked: 1st request: Ran a Web Search for the bug instead of writing the report. 2nd request: Began analyzing outputStyle and the custom statusLine config and proposed modifying the user's local machine configuration — none of which was requested. 3rd request: Started probing TERM_PROGRAM / environment variables to "diagnose" the cause. The user repeatedly objected ("Why are you going online? I gave you a clear instruction"), yet the assistant continued initiating new diagnostic actions instead of honoring the explicit, narrowly-scoped request. It treated its own assumption ("the user wants me to root-cause and fix this") as higher priority than the user's stated request. Additional issue: The assistant's root-cause hypothesis kept shifting and contradicting itself — first "only loops trigger it," then self-refuted, then blamed the custom statusLine, then blamed "Warp" (the user was actually on Apple Terminal, so this attribution was also wrong). This indicates the cause was never actually identified; the assistant was iterating on guesses while ignoring the user's instructions. Expected behavior Bash tool output should render once and not duplicate, regardless of whether the command uses loops, pipes, or streaming output. When the user gives an explicit, scoped instruction (and repeats it after objecting), Claude Code should execute that instruction directly and not substitute its own diagnostic agenda or modify local configuration unprompted. Actual behavior Output was duplicated thousands of times, stalling the session repeatedly. A simple "write a bug report" request was ignored three times in favor of unsolicited web searches, config analysis, and environment probing. Severity High — the rendering bug makes the tool unusable for an extended period, and the instruction-following failure means the user cannot reliably redirect the agent even with clear, repeated commands.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.172
  • Feedback ID: 1f045628-1b93-454c-89c8-307effc24a00

Errors

[]

View original on GitHub ↗

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