[BUG] Infinite generation loop consumes entire context + rate limit when prompted to continue

Status Open
Reported on v2.1.158
Maintainer reply None cached
Activity 0 comments · opened Aug 6, 2026

Preflight Checklist

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

What's Wrong?

Claude Code entered an infinite generation loop when I typed a short continue prompt ("ต่อ" = "continue" in Thai), consuming my entire context window and rate limit budget.

Before bug:

  • Context window: LOW (plenty remaining)
  • 5-hour rate limit: just reset (near 0% used)

After bug (screenshot attached):

  • Context: 840.7k / 1.0M consumed (84%)
  • 5-hour limit: 87% consumed

What happened:
Claude Code repeatedly generated "court <br>" hundreds of times with no stop condition, until the app became completely unresponsive and all work was lost.

Expected behavior:

  • Detect repetitive/degenerate output and stop
  • OR warn user and ask for clarification

Environment:

  • Model: Opus 4.8 (High)
  • OS: Windows 11
  • Date: 2026-08-06

Impact:
~840k tokens and 87% of rate limit quota were wasted with zero productive output. Is it possible to restore the consumed quota?

What Should Happen?

Detect repetitive output and stop generation, or warn user that output is looping

Error Messages/Logs

No error message was displayed. 
Claude Code silently entered an infinite loop, 
repeatedly outputting "court <br>" with no warning or stop condition. 
The app became unresponsive and had to be force-closed.

Steps to Reproduce

  1. Start Claude Code session with Opus 4.8 (High)
  2. Context window and rate limit were both low/recently reset
  3. Type a short continue prompt ("ต่อ")
  4. Claude Code begins infinitely repeating "court <br>" with no stop

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.158 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

The bug consumed approximately 840k tokens and 87% of the 5-hour rate limit
with zero productive output. Both the context window and rate limit were
low/recently reset BEFORE the bug occurred — the runaway loop itself caused
the consumption.

Is it possible to restore the consumed quota? This was entirely caused by
a bug on Claude Code's side, not intentional usage.

<img width="701" height="310" alt="Image" src="https://github.com/user-attachments/assets/887df3f6-f352-4b14-b5d8-862cbe5fb824" />
<img width="1236" height="952" alt="Image" src="https://github.com/user-attachments/assets/5727fe84-e590-4372-9bcc-31cfb20b61e6" />

View original on GitHub ↗