Degenerate repetition loop — single token repeated ~32k times until max_tokens (silent, reproduces across 2 model generations)
Status Open
Maintainer reply None cached
Activity 5 comments · opened Jul 31, 2026
We observed assistant responses occasionally entering a degenerate repetition loop: a single token ("court") is emitted ~32,000 times until the max output token limit, terminating as a formally-normal response (silent — no error surfaced).
Observations (measured from transcript logs):
- Frequency: 23 of 1,471 assistant responses within one affected session.
- Models: reproduced on 2 generations —
claude-opus-4-8(20 occurrences) andclaude-opus-5(3 occurrences). Not resolved across the update. - Repetition count clustered at 31,479–31,974 (i.e., burns the full output token budget on every occurrence).
- Concentration: all 23 occurrences are within a single conversation session, fixating on one specific token — suggesting a context-triggered failure rather than a model-wide one.
- Impact: because the response is formally normal, it is silent and goes undetected; each occurrence wastes the full output token budget.
Context (not anonymized, per our decision to report transparently):
- Organization: uti-inc. Observed in a production workflow (Claude Code).
- Affected session ID:
52e08c36-502c-4c97-9bd5-154f58ab375f(in case server-side correlation is possible). - No customer data is included in this report; the degenerate portion is pure token repetition.
Question: Is this a known issue? Any mitigation or detection guidance (e.g., a way to surface these as failures rather than silent normal responses)?
Showing cached comments. Read the full discussion on GitHub ↗
4 Comments
Update: this appears to be a duplicate of #68740 and #65823 (same
court-token degenerate repetition). Cross-linking for the maintainers.We found these after filing. This report does add 3 data points not present in those issues, in case they help:
claude-opus-5— #68740 is opus-4-8 and #65823 does not mention opus-5. The failure mode propagated across the model generation.Feel free to close this as a duplicate; flagging the opus-5 propagation as a possibly-new signal for #68740 / #65823. The trigger hypothesis in #68740 (Japanese prose immediately before/around a tool call) matches our situation exactly.
Correction to the figures above. A more complete scan — recursively including subagent logs, which our initial pass missed — shows this is more widespread than first reported:
<project>/<uuid>/subagents/agent-*.jsonl).The duplicate status (of #68740 / #65823) and the opus-5 propagation still stand. The added signal is the cross-session / cross-repo spread (not a single-session anomaly), which may be useful for the trigger hypothesis. Still no customer/third-party data included.
Follow-up: we built a post-hoc detector, and re-scanning with it surfaced some signals we had not reported. This partly answers our own "detection guidance" question — happy to hand over the script if it is useful to anyone.
Detection recipe (what actually worked)
Scanning our whole local transcript store (
~/.claude/projects, 609 sessions / ~1.5 GB) takes about 5 seconds:(?:(\w+)\s+){8,}$against a 220,000-char repetition string backtracks catastrophically — one project did not finish in 10 minutes. The collapse is by definition at the tail, so a tail window is both sufficient and linear-time.<project>/*.jsonlglob misses<project>/<session-uuid>/subagents/agent-*.jsonl— in our store that is 491 of 600 files. Our original undercount of 23 came from exactly this.New signals from the re-scan
52e08c36collapsed 18× onclaude-opus-4-8(last at 09:13 UTC) and then 3× onclaude-opus-5(11:24 UTC onward) — same conversation, samecourttoken, no change in behaviour across the switch. That points at conversation state rather than model weights, consistent with the trigger hypothesis in #68740.dce443a8: 2026-07-18T22:02:37, 22:40:25, 23:18:26, 23:56:42, 2026-07-19T00:34:34 (UTC) — inter-arrival times 37m48s / 38m01s / 38m16s / 37m52s. The first session's spacing is irregular by contrast (8–30 min). A near-constant period suggests something cyclical within the session (context growth / compaction cycle) rather than independent sampling.court\n\n). The three opus-5 occurrences cluster more tightly (31,953–31,974) than opus-4-8.Aggregate counts are unchanged from the previous comment: 26 occurrences, 2 sessions, 2 repositories, token
courtin 100% of cases. Still no customer or third-party data included.Additional occurrence, matches this pattern closely:
claude-sonnet-56e288ddc-c2d2-45d4-844d-8d592249e67egit committool calls, in the turn meant to summarize/report those commits back to the user. Response degenerated into thousands of repetitions of the one character with zero real content, ran to the output limit, formally normal (no error).Adding in case it helps correlate trigger conditions across sessions rather than filing a duplicate.