Runaway output: model repeats fixed string "court placeholder" thousands of times, exhausting output tokens (long-running session, large context)

Open 💬 3 comments Opened Jun 6, 2026 by jangom2ok

Runaway output: model repeats fixed string "court placeholder" thousands of times, exhausting output tokens (long-running session, large context)

Note: A deterministic clean reproduction is not yet established. Below are observations from real sessions plus a correlation-based characterization of the triggering conditions.

Summary

In long-running agent sessions of Claude Code (v2.1.165, model Claude Opus 4.8 / 1M context), after a normal response the model begins emitting the meaningless fixed string court placeholder repeatedly and runs away. Worst case: a single response consumed all 64,000 output tokens on this repetition (10,613 repeats in one message). Tool-call generation also breaks concurrently, causing loops and token waste.

Observed conditions (correlation analysis of real logs)

  • Model: Claude Opus 4.8 (1M context) / Claude Code 2.1.165
  • Long-running: first occurrence ~6h after session start (total ~15h uptime)
  • Large cumulative context: ~275,000 tokens at first occurrence; grew to ~994,000 (near the 1M limit) as it worsened
  • High-frequency tool calls: 61 tool-call/result cycles before first occurrence (periodic polling loop)
  • No compaction involved (0 compaction events before first occurrence)
  • First occurrence on a normal response turn right after a tool call: court placeholder appended to the end of otherwise-normal text, then snowballed in subsequent messages

Expected vs actual

  • Expected: the turn ends normally, or a well-formed tool call is generated.
  • Actual: the fixed string is mass-repeated, generation breaks and loops.

Impact

  • Massive token waste (64,000 output tokens of pure repetition in a single message).
  • Sessions stall / loop; automated processing stops progressing.
  • Recurred intermittently over ~9.4 hours (82 affected messages).
  • Froze an interactive TUI session: in one instance the runaway output froze an interactive agent session's terminal UI while a user was actively on that screen, requiring manual Esc / Ctrl-C to break the loop and recover (~30 min unusable before manual recovery).

Environment

  • Claude Code 2.1.165 / Claude Opus 4.8 (1M context) / macOS (Darwin 25.5.0)
  • Injection-source check: a full-text search of local config/extensions (settings.json / skills / agents / hooks / statusline / instruction files) found no source of the string, so it does not appear to be locally injected — it looks like a model- or harness-side generation defect.

Reproduction status (honest)

  • No deterministic clean repro yet. The event is state-dependent: long-running + large context (hundreds of thousands up to ~1M tokens) + high-frequency tool loop → it occurs probabilistically. It has not been reproduced in short / minimal configurations.
  • A dedicated repro harness (sustained high-frequency tool calls building context near the limit) would likely be needed to force a deterministic repro.
  • Available material: transcript (JSONL) excerpts including the first occurrence, the worst message, and token usage.

View original on GitHub ↗

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