[BUG] VSCode: Switching to a lighter model mid-session leaves session stuck — misleading error makes recovery non-obvious.

Resolved 💬 2 comments Opened Apr 22, 2026 by jahanzaibr Closed May 28, 2026

Summary

If you interrupt Claude mid-task and switch to a lighter model (e.g. Opus → Sonnet), the session
can become completely stuck: every message returns "Prompt is too long" and /compact also fails.
The error shown during /compact is misleading and points the user in the wrong direction.
The actual recovery is simple (switch back to the original model → /compact) but nothing
in the product tells you this.

Environment

  • Claude Code version: 2.1.117.320 (VS Code extension)
  • Platform: Windows 11 Enterprise
  • Session built on: claude-opus-4-7 (standard — not 1M, no extra usage)
  • Switched to: claude-sonnet-4-6 (via /model default)

Exact Sequence of Events

  1. Long coding session running on standard Opus. Context accumulated to ~637k tokens.
  2. Rate-limit warning appears (~92%). User presses Stop to interrupt Claude mid-task.
  3. User runs /model default → switches to Sonnet (lighter model).
  4. Waits ~50 minutes for rate limit to reset.
  5. Sends continue"Prompt is too long"
  6. Sends continue again → "Prompt is too long" again. Session stuck.
  7. Tries /compact → fails with:

Error: Error during compaction: API Error: Extra usage is required for 1M context ·
enable extra usage at claude.ai/settings/usage, or use --model to switch to standard context

  1. Switches back to standard claude-opus-4-7 (no 1M, no extra usage plan).
  2. Runs /compactsucceeds: Compacted chat · manual · 637k tokens freed
  3. Sends continue → session resumes normally.

Root Cause

The session's 637k tokens fit within Opus's standard context window but exceed Sonnet's
(~180k effective). Claude Code allows the model switch without checking this. Once on Sonnet,
the session is too large to process and /compact also fails because compaction itself
must fit within the active model's window.

From the VS Code output log:
autocompact: tokens=636851 threshold=167000 effectiveWindow=180000

API error (attempt 5/11): 429
{"type":"rate_limit_error","message":"Extra usage is required for long context requests."}
request_id: req_011CaK9SET6PcTvXrkZa5eZ1

The Misleading Error

When /compact fails on Sonnet, the error shown is:

"Extra usage is required for 1M context · enable extra usage at claude.ai/settings/usage, or use --model to switch to standard context"

This is inaccurate and misleading in this scenario:

  • The user was never on a 1M context model — the session was built on standard Opus
  • "Extra usage" is not needed — no paid upgrade is required
  • "Switch to standard context" is the opposite of what helps — the user needs to switch

back to the larger model (Opus), not a smaller "standard" one

  • The actual fix requires zero new permissions: just /model back to Opus → /compact

The error misdirects users toward a paid plan upgrade when the real solution is free and
already available to them.

Suggested Fixes

Option A — Prevent it before it happens (ideal):
Before completing a model switch, check if the session's current token count exceeds the
target model's effective context window. If it does:

  • Auto-compact using the current model first, then switch (show a status line:

"Compacting session before switching to Sonnet…")

  • OR warn: "Your session (637k tokens) exceeds Sonnet's context window (180k).

Run /compact first, or stay on Opus."

Option B — Show recovery guidance when already stuck:
When both a user message and /compact fail on the current model, display:
*"Session context is too large for this model. Switch back to [claude-opus-4-7]
and run /compact to recover your session — no extra usage or plan change required."*

Option C — Fix the misleading error message:
Replace the current "Extra usage is required for 1M context" message (which implies a
paid upgrade is needed) with one that accurately describes the situation:
*"Session context (637k tokens) exceeds Sonnet's standard context window. Switch back
to Opus with /model claude-opus-4-7, run /compact, then switch to your preferred model."*

Screenshot

<img width="1296" height="885" alt="Image" src="https://github.com/user-attachments/assets/6352cdaf-f116-4953-a87c-830c0463aa92" />

Related Issues

  • #23377 — Session-breaking "Prompt

is too long" with no recovery path (open/critical). Same symptom, different trigger —
no model switch involved, just organic context exhaustion.

failure after "Prompt is too long". Overlapping symptom.

  • #14472 — CLI resume deadlock

when context exceeds limit. Same "can't compact when over limit" pattern.

View original on GitHub ↗

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