Agent stuck in infinite loop — repeated 'let me write the document' without executing, burned full context window

Resolved 💬 3 comments Opened Feb 21, 2026 by brickhousemb Closed Feb 24, 2026

Bug Description

During a multi-agent research task, Claude Code got stuck in a loop where it repeatedly stated "let me write the document" across multiple turns without ever actually calling the Write tool. This continued until the full context window was consumed and the session had to be compacted/continued. The actual task (writing a single markdown file from completed agent outputs) took ~10 seconds once the new session started.

Steps to Reproduce

  1. Launched 4 parallel research agents (Task tool, subagent_type=general-purpose)
  2. All 4 agents completed successfully with full outputs
  3. Next step was to assemble outputs into a single markdown file via Write tool
  4. Instead of writing, Claude repeatedly said variations of "let me assemble the document now" without invoking any tool
  5. This looped across multiple turns until context was exhausted

Expected Behavior

After all 4 agents completed, Claude should have called the Write tool to create the output file. One turn, one tool call.

Actual Behavior

Claude entered a loop of stating intent to write without executing. User had to intervene multiple times before the session was compacted and a fresh continuation actually performed the write.

Impact

  • Full context window burned on zero-value loop iterations
  • Significant token waste on an Opus 4.6 session
  • User had to manually intervene and restart

Environment

  • Model: claude-opus-4-6
  • Platform: Linux (Ubuntu, CLI)
  • Claude Code version: 2.1.50
  • Date: 2026-02-21

Request

Requesting a usage credit for the wasted tokens in the looping session. This was a clear bug where the model failed to invoke the tool it stated it would use, repeatedly, across the entire context window.

View original on GitHub ↗

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