[Bug] claude-opus-5 enforced at ~200K by API while client treats it as 1M — all 12 'Prompt is too long' failures at 166K–178K; opus-4-8/fable-5 pass 356K–857K on same account
TL;DR — root cause
claude-opus-5 requests are enforced at a ~200K context window by the API while the Claude Code client treats the model as 1M end-to-end. The client's built-in model table marks Opus 5 native_1m, the statusline//context gauge is computed against 1,000,000, and the user sees "17% used" — but the very next request dies with Prompt is too long. Every failure lands in the 165,964–177,975 token band (= 200,000 minus output reservation). Sibling 1M models on the same account, same day, some in the same session sail past that line up to 856,901 tokens.
This is not a "user filled 1M" situation. It is a client↔server disagreement about what window claude-opus-5 gets, and the client's optimistic 1M display makes the session walk into a hard kill with zero warning.
Evidence 1 — model-switch A/B inside one session
Session ed48ca97 (2026-07-29 UTC), continuous context, no settings change in between:
| time (UTC) | model | prompt size (input+cache_read+cache_creation) | result |
|---|---|---|---|
| 03:03 | claude-opus-4-8 | 356,562 | ✅ success |
| 03:18 | claude-opus-5 (switched) | same ~356K context | ❌ Prompt is too long |
| 06:19 (after compaction to 165,964) | claude-opus-5 | 165,964 | ✅ success |
| 06:19–06:51 (4 attempts crossing ~168K+) | claude-opus-5 | — | ❌ Prompt is too long ×4 |
The window demonstrably dropped from ≥356K to ~200K at the moment the model changed — nothing else changed.
Evidence 2 — all 12 failures, one band
Forensic scan of all local session logs: 2,013 jsonl files (259 top-level + 1,754 subagent), 215,435 lines, 1.13 GB. Exactly 12 isApiErrorMessage:true "Prompt is too long" events exist, all on 2026-07-29, all on claude-opus-5 (10 main-loop + 2 subagents that inherited the parent's opus-5):
| session | failure time (UTC) | last successful prompt before death | trigger of fatal request |
|---|---|---|---|
| ed48ca97 | 03:18, 05:22, 05:23 | 356,562 (on opus-4-8) | model switched to opus-5 |
| ed48ca97 | 06:19, 06:34, 06:35, 06:51 | 165,964 | Task/Agent launch, task notifications |
| ed48ca97 subagent a93d56bb | 06:34 | 176,390 | one more file Read |
| ed48ca97 subagent a29c1e93 | 06:35 | 177,975 | one ToolSearch result |
| e43f274f | 08:14, 08:16 | 176,622 | a 594-char Bash tool_result |
| 7739a1a8 | 09:01 | 171,604 | a single PNG Read (~100KB base64) |
Failure band: 165,964–177,975. With the client's own output reservation (min(maxOutputTokens, 20000)) and blocked-gate margin, this is numerically exact for a 200,000 window and impossible for 1,000,000.
Evidence 3 — fleet statistics: no opus-5 request has ever crossed 200K here
Across the same 2,013 files, 345 files show contexts above 200K. Model at the time:
| model | files >200K | max prompt tokens observed |
|---|---|---|
| claude-opus-4-8 | 183 | 839,535 |
| claude-fable-5 | 109 | 856,901 |
| claude-sonnet-5 | 53 | — |
| claude-opus-5 | 0 | 177,975 (never crossed) |
Same machine, same account, same settings. Only claude-opus-5 hits an invisible 200K wall.
Evidence 4 — the client believes 1M (v2.1.220 binary strings)
From the installed 2.1.220 native binary:
- Model table entry for Opus 5:
context:{window:1e6, native_1m:!0, supports_1m_beta:!0, supports_1m_suffix:!0} - Client window calc returns
1e6for[1m]-suffixed ornative_1mmodels → statusline //context/ warn-compact-blocked thresholds are all computed against 1,000,000. - Request assembly attaches beta
context-1m-2025-08-07when the model string carries[1m], and sends the stripped base id on the wire.
So the client attaches the 1M beta (sessions ran claude-opus-5[1m] per lastModelUsage), displays 1M, gates nothing — and the server still evaluates ~200K, for this one model only.
Candidate mechanisms (for maintainers to disambiguate)
- Server-side entitlement mismatch: 1M for
claude-opus-5not actually enabled for this account tier (Max 20x subscription; extra usage disabled at org level —cachedExtraUsageDisabledReason:"org_level_disabled"), whileopus-4-8[1m]and native-1Mfable-5are honored. Client model table doesn't know about the gate, so it lies to the user. - Client-side header gap on some path: a request path drops the
context-1m-2025-08-07beta for opus-5 (cf. #81142, auto-mode sending[1m]models without the beta header), and the server's default window for bareclaude-opus-5is 200K.
Either way: the client must not display a 1M window while requests are being evaluated at 200K. Users plan long sessions against the gauge and lose them mid-work (12 hard failures in one day here, including two subagents dying before reporting).
Secondary issue — the raw API error is never persisted
Claude Code writes only the synthetic 18-char string "Prompt is too long" into session jsonl. The API's numeric detail (... N tokens > M maximum) — which would have made this diagnosis trivial (M=200000 vs M=1000000) — is discarded. A scan of all 259 top-level logs found zero numeric context-error strings. Please persist the raw error body (or at least N and M) with the synthetic message.
Environment
- Claude Code v2.1.220 (native exe via npm wrapper), Windows 11 Pro 10.0.26200
- Auth: OAuth subscription (Max 20x); extra usage disabled at org level
settings.json: model pinned (claude-fable-5[1m]; sessions in question ran Opus 5 via/modelpicker →claude-opus-5[1m]),DISABLE_AUTO_COMPACT=1(so failures surface as raw API rejections, no compaction interference)
Repro
- Claude Code 2.1.220, Max-tier OAuth account,
/model→ Opus 5 (shows 1M). - Accumulate ~170K context (read a few large files).
- Any next request →
Prompt is too long, while the gauge shows ~17%. /model→ Opus 4.8[1m]or Fable 5 → the very same context continues fine past 350K.
Related
#81693 (Opus 5 window reported 200k), #81068 (Bedrock Opus 5 budgeted 200K, catalog omits native_1m_3p), #81039, #81973, #80626, #80272, #81025 (silent fallback overwrites saved model), #81142 (beta header dropped in auto mode). This report adds controlled A/B evidence (same session, model switch), fleet-scale statistics (2,013 logs), and the exact failure band matching a 200K evaluation.