Thinking phase gets stuck in repetitive token loop, wasting ~2k+ tokens

Resolved 💬 2 comments Opened Jun 28, 2026 by tomo600 Closed Jul 1, 2026

Description

During the thinking/reasoning phase, the model occasionally gets stuck in a repetitive token generation loop. In the observed case, the phrase "not called" was repeated hundreds of times, consuming approximately 2.3k tokens before the loop ended.

Reproduction

  • The thinking trace started with a meaningful analysis about testing a store-level guard (React controller hook, _syncGen matching)
  • After the meaningful content, the model began repeating "Not called not called not called..." for the remainder of the thinking block
  • The repetition continued until the thinking token limit was reached

Screenshot

The user observed this in the VS Code extension. The thinking block contained ~2 lines of meaningful reasoning followed by hundreds of repetitions of "not called".

Impact

  • Wasted tokens: ~2.3k tokens of pure repetition with zero value
  • Wasted cost: Users are paying for tokens that provide no benefit
  • No user-side mitigation: There are no exposed parameters (e.g., repetition penalty) for users to control thinking generation behavior

Expected behavior

The model should detect repetitive token generation during the thinking phase and stop early, rather than continuing to generate identical tokens until the limit is reached.

Environment

  • Claude Code VS Code extension
  • Windows 11
  • Model: claude-opus-4-6

View original on GitHub ↗

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