[BUG] Extended thinking runs away to max_tokens (64k) on a trivial edit, stalling turns 12–16 min each

Open 💬 0 comments Opened Jul 13, 2026 by LightSpeedC

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?

Bug report: Extended thinking runs away to max_tokens (64k) on a trivial edit, stalling turns 12–16 min each

TL;DR (English)

On Claude Code with model claude-opus-4-8 (1M context), a trivial documentation edit
(appending a "created/updated date" string to an HTML header) caused extended thinking
to run all the way to the 64,000-token ceiling and get cut off with
stop_reason: "max_tokens"twice in a row. Each runaway took 12–16 minutes of
wall-clock time with no tool call and no visible progress, and burned ~64,000 output
(thinking) tokens per turn (~128,000 total) for a task that should complete in seconds.
This is not a rate-limit or API error — no rate_limit / API error records exist in the
session log. It looks like a thinking-budget / runaway-reasoning bug, aggravated by a loop
of failed Edit calls (String not found).

---

(Japanese)

Environment

  • Product: Claude Code (CLI) 2.1.207 (Claude Code)
  • Model: claude-opus-4-8 (1M context)
  • OS: Windows Server 2022 Standard (10.0.20348)
  • Shell: PowerShell / Bash (併用)
  • 作業ドライブ: ネットワークドライブ(SMB)
  • 発生日: 2026-07-13(以下タイムスタンプは会話ログの UTC 表記)

事象の概要

ドキュメント(HTML)のヘッダに「作成: / 更新:」の日付文字列を1つ追記するだけの些細な作業中に、
拡張思考(extended thinking)が思考トークン上限 64,000 に達して stop_reason: max_tokens
で打ち切られる
現象が連続して発生した。1回の打ち切りにつき実時間で 12〜16 分、可視の進捗
(テキスト出力・ツール呼び出し)が一切ないまま停止しているように見えた。

客観的な証拠(セッション JSONL から抽出)

会話ログの該当メッセージ。out は当該アシスタントメッセージの usage.output_tokens

| 区間(UTC) | 実時間 | 次イベント | stop_reason | output_tokens |
|---|---|---|---|---|
| 00:03:09 → 00:15:37 | 約 12分28秒 | assistant(THINKING のみ) | max_tokens | 64,000 |
| 00:16:11 → 00:32:12 | 約 16分01秒 | assistant(THINKING のみ) | max_tokens | 64,000 |

  • 直前のユーザー入力はいずれも短い(例: 「OK」)。処理内容は「日付文字列を1つ追記」レベル。
  • 打ち切られた思考ブロックはテキストとして保存されておらず(THINKING(0chars))、

トークン数のみ 64,000 = 上限に張り付いている。

  • 打ち切り後、モデルは次メッセージで思考を継続しており、reasoning が収束せずに

上限まで走ったことを示唆する。

併発した二次的問題(トークン浪費を拡大)

同一タスクの後半(00:54〜00:59 UTC)で Edit ツールが String not found により連続失敗
(tool_result エラーが多数)。同じ編集を記憶ベースの old_string でリトライし続けたことで、
リトライのたびに思考が積み上がり、無駄な出力トークンをさらに消費した。

期待される挙動

  • 「文字列を1つ追記する」程度の自明なタスクで拡張思考が 64k 上限まで走らないこと。
  • reasoning が収束しない場合でも、上限到達を延々繰り返す前に打ち切る/短絡するセーフガードが働くこと。
  • Edit 失敗が連続した際にリトライ思考が発散しないこと。

実害

  • 2ターンで実時間 約28分半の停止。
  • 拡張思考の出力トークン ≒ 64,000 × 2 = 約 128,000 トークンを、成果に結びつかない形で消費

(加えて Edit リトライ分)。

  • ユーザー体感としては「無反応で固まっている」状態。

再現条件(推定)

  • 大きめのコンテキスト(1M モデル、長い会話・大きな HTML ファイル群)。
  • 「1ファイルずつ」「文字コードに注意」等の細かい制約が会話履歴に多数ある状況。
  • 自明だが制約の多い編集を、Read を省いて記憶から old_string を構成した場合に Edit が失敗し、

リトライで思考が発散。

要望

  1. 拡張思考が max_tokens 上限に到達する暴走を検知・抑制するセーフガード。
  2. reasoning 発散時に無反応で長時間停止しないよう、進捗表示または早期打ち切り。
  3. (課金/クレジットに関する相談は別途サポート窓口にて)本件で消費された思考トークンの扱いについて確認したい。

補足

  • 本件はセッション JSONL ログを解析して確認した。ログ内に rate_limit / API エラーのレコードは

存在せず、レート制限・ネットワーク・SMB ドライブ起因ではない。

  • 参考: セッション ID / 詳細ログは必要に応じて提供可能(ローカルユーザー名等の PC 固有情報はマスク)。

What Should Happen?

already described abve.

Error Messages/Logs

Steps to Reproduce

already described abve.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.207 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗