CONTEXT_WINDOW_EXCEEDED classification only opens recovery. The summary request must still fit its route and replace the selected range with a complete smaller checkpoint.Classification decides whether recovery runs.
CONTEXT_WINDOW_EXCEEDEDprune → compact → retryThe compaction listener receives its exact machine code.
INVALID_REQUESTfail → manual recoveryThe same physical overflow bypasses the listener.
Read the body, not only the provider code.
{
"message": "Input token exceed the limit",
"type": "api_error",
"code": "quota_limit_reached"
}quota_limit_reached can also describe account or monthly usage limits. Match the context wording narrowly and retain the raw response beside the normalized error.
Budget the next request before sending it.
Price the recovery request separately.
system + tools + visible history+ requested outputThis is the envelope the provider rejected.
system + tools + selected replay+ instruction + summary outputA recovery label does not make this envelope smaller.
A smaller model is a capacity transition.
last durable route: 1Mold thresholdrc.2 pressure handling reads the latest Session request header.
pending route: 200Knew denominatorThe smaller capacity is recorded after pre-step, before the provider call.
Stop a stable failure fingerprint.
trigger + route + replaceGeneration
+ selected start:end + token count
+ finish reason + normalized errorExpand the balanced range, reduce retention, change the approved summary route, or terminate durably. Never weaken the complete-and-smaller checkpoint invariant.
Recover in a bounded order.
- 01Capture
Save the raw body, normalized code, model, adapter, and request ID.
- 02Lower output
Reduce
maxTokensonly if the history still leaves usable headroom. - 03Compact once
Try
/compactonce. Stop if its summarizer also exceeds context. - 04Continue cleanly
Open a new Session with a concise handoff and links to retained evidence.
Regression needs a positive and a negative.
Input token exceed the limitCONTEXT_WINDOW_EXCEEDEDMonthly usage quota exceededusage or account limitAcceptance gates.
- Raw provider body is retained.
- Normalized code is observable.
- Real overflow reaches the listener.
- Usage quota stays a separate class.
- Both serialized envelopes are priced.
- Failed range fingerprints are stable.
- No surface change means no identical retry.
- A clean continuation preserves evidence.
Primary evidence.
- Upstream report #3399
- llama.cpp recovery and media report #4420
- 1M→200K model-switch report #4826
- rc.2 shared error classifier
- rc.2 recovery and retry proof
- Related WebP media-capability route
Keep the complete runbook.
The canonical guide includes capture fields, request arithmetic, failure fingerprints, decision branches, and twelve convergence checks.
Read the full overflow runbook