claude-code - 💡(How to fix) Fix context_window_size reported as 200000 for claude-opus-4-8 (1M-context model) → "100% context used" clamps prematurely

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

For claude-opus-4-8, the statusline JSON reports context_window.context_window_size: 200000 and clamps used_percentage: 100 / remaining_percentage: 0 once usage passes 200k — but the session keeps running fine well past that with no compaction, so the true window is the 1M variant. The built-in "N% context used" indicator therefore pins at "100% context used" while ~64% is actually free.

Root Cause

For claude-opus-4-8, the statusline JSON reports context_window.context_window_size: 200000 and clamps used_percentage: 100 / remaining_percentage: 0 once usage passes 200k — but the session keeps running fine well past that with no compaction, so the true window is the 1M variant. The built-in "N% context used" indicator therefore pins at "100% context used" while ~64% is actually free.

Code Example

{
  "model": { "id": "claude-opus-4-8", "display_name": "claude-opus-4-8" },
  "context_window": {
    "total_input_tokens": 360236,
    "context_window_size": 200000,
    "current_usage": {
      "input_tokens": 2,
      "cache_creation_input_tokens": 13043,
      "cache_read_input_tokens": 347191
    },
    "used_percentage": 100,
    "remaining_percentage": 0
  }
}
RAW_BUFFERClick to expand / collapse

Version

Claude Code 2.1.154 (the minimum required for, and current latest npm release for, claude-opus-4-8)

Model

claude-opus-4-8

Summary

For claude-opus-4-8, the statusline JSON reports context_window.context_window_size: 200000 and clamps used_percentage: 100 / remaining_percentage: 0 once usage passes 200k — but the session keeps running fine well past that with no compaction, so the true window is the 1M variant. The built-in "N% context used" indicator therefore pins at "100% context used" while ~64% is actually free.

Statusline JSON snapshot (from a live session)

{
  "model": { "id": "claude-opus-4-8", "display_name": "claude-opus-4-8" },
  "context_window": {
    "total_input_tokens": 360236,
    "context_window_size": 200000,
    "current_usage": {
      "input_tokens": 2,
      "cache_creation_input_tokens": 13043,
      "cache_read_input_tokens": 347191
    },
    "used_percentage": 100,
    "remaining_percentage": 0
  }
}

Note current_usage sums to 360,236 tokens — already 1.8× the reported 200k window — yet the session is alive with no compaction.

Expected

context_window_size should reflect the model's true (1M) window for claude-opus-4-8, so used_percentage / remaining_percentage and the context indicator are accurate.

Related

Same class of bug previously reported for Opus 4.7 [1M]: #49931, #50716.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING