claude-code - 💡(How to fix) Fix [BUG] Bash and Read tool outputs arriving one turn late

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

During an interactive Claude Code session, Bash and Read tool outputs began arriving one turn late — each command's real output only surfaced after the next tool call was issued, rather than immediately. Over the session this degraded further into tool results being lost entirely ("Tool result missing due to internal error").

Error Messages/Logs

Fix Action

Fix / Workaround

Impact Forced a workaround of issuing throwaway no-op commands (printf 'flush\n') to advance/drain the buffer, plus a switch to writing results to temp files and reading them back. Many wasted tool calls and difficulty confirming whether operations (including a git commit) actually succeeded.

Workarounds that helped

  • Redirecting command output to a temp file (cmd > /tmp/out.txt) then reading the file rendered more reliably than raw bash stdout.
  • Issuing extra trivial calls to flush previously stuck output.

Code Example

Bash(printf 'flush\n')
  ⎿  flush

Bash(cd /home/dwalleck/.claude/projects/-home-dwalleck-repos-rivets
      {)
  ⎿  written
  ⎿  Shell cwd was reset to /home/dwalleck/repos/rivets
  ⎿  Allowed by auto mode classifier

Bash(printf 'f2\n')
  ⎿  f2

  Read 1 file (ctrl+o to expand)

Bash(printf 'f3\n')
  ⎿  f3

  Read 1 file (ctrl+o to expand)

Bash(printf 'f4\n')
  ⎿  f4
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

(Description written by Claude for better accuracy) Session ID: d848440f-3756-4916-8e74-9c209dfc605b

During an interactive Claude Code session, Bash and Read tool outputs began arriving one turn late — each command's real output only surfaced after the next tool call was issued, rather than immediately. Over the session this degraded further into tool results being lost entirely ("Tool result missing due to internal error").

Symptoms (in order of progression)

  1. Bash commands initially returned blank; their actual stdout appeared on the following tool call (consistent ~1–2 turn lag).
  2. Some results were dropped outright instead of just delayed.
  3. One Read returned corrupted/garbled content that did not match the file on disk.
  4. Large outputs were redirected to a persisted-output file, which still resolved correctly.

Impact Forced a workaround of issuing throwaway no-op commands (printf 'flush\n') to advance/drain the buffer, plus a switch to writing results to temp files and reading them back. Many wasted tool calls and difficulty confirming whether operations (including a git commit) actually succeeded.

Workarounds that helped

  • Redirecting command output to a temp file (cmd > /tmp/out.txt) then reading the file rendered more reliably than raw bash stdout.
  • Issuing extra trivial calls to flush previously stuck output.

What Should Happen?

Tool output should arrive on the same turn

Error Messages/Logs

● Bash(printf 'flush\n')
  ⎿  flush

● Bash(cd /home/dwalleck/.claude/projects/-home-dwalleck-repos-rivets
      {)
  ⎿  written
  ⎿  Shell cwd was reset to /home/dwalleck/repos/rivets
  ⎿  Allowed by auto mode classifier

● Bash(printf 'f2\n')
  ⎿  f2

  Read 1 file (ctrl+o to expand)

● Bash(printf 'f3\n')
  ⎿  f3

  Read 1 file (ctrl+o to expand)

● Bash(printf 'f4\n')
  ⎿  f4

Steps to Reproduce

This is just happening in any session without any special behavior.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.156

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

Session ID: d848440f-3756-4916-8e74-9c209dfc605b

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Bash and Read tool outputs arriving one turn late