Corrupted git diff --stat tool result (one line repeated thousands of times) degraded model behavior for the rest of the session

Open 💬 0 comments Opened Jul 7, 2026 by runesleo

Environment

  • Claude Code: 2.1.201
  • Model: Claude Opus (4.x)
  • OS: macOS 15.6.1 (Darwin 24), arm64
  • Surface: Claude Code CLI, long single session (~50+ turns), heavy Bash/git tool use

Summary

In a long, tool-heavy session, a git command's output came back massively corrupted inside a tool result: a single git diff --stat-style line (README.md | 12 ++++...) was repeated for thousands of lines instead of the normal short diffstat. After the model consumed that corrupted tool result, its behavior became unstable for the rest of the session — it began narrating "messages" it believed it had received (e.g. a session-end notice, an "automated check", an "afk, continue autonomously" prompt) that were not actually present in any tool result or system message. In other words, the corrupted oversized tool output appears to have destabilized the model into confabulating inputs.

I verified against the local transcript: the corrupted repeated output is genuinely in a tool_result; the "system-like" phrases the model reacted to are only in the model's own assistant text, not in any tool_result or system message. So this reads as: (1) a real bug — a tool result was returned corrupted/hugely-repeated, and (2) a downstream effect — that corrupted context degraded model reliability.

Expected

  • Tool results should carry the actual command output, not a single line repeated thousands of times.
  • Oversized / malformed tool output should be truncated or flagged rather than passed through verbatim.

Actual

  • A git diff --stat tool result contained one diffstat line repeated for thousands of lines.
  • After ingesting it, the model's behavior degraded (confabulated non-existent instructions) for the remainder of the session.

Repro

Not reliably reproducible — reporting one observed occurrence. Preconditions present:

  • Long session (~50+ turns), continuous Bash/git tool calls.
  • Large git operations; one git diff --stat returned the corrupted repeated output, and the degradation began from there.

Questions

  1. Is there a known path by which a tool result (esp. from git with large output) can be returned corrupted / with a line repeated many times?
  2. Are tool results size-capped / truncated before being returned to the model, and at what threshold?

I can share the redacted local session transcript (the corrupted tool_result block) privately if useful for triage.

View original on GitHub ↗