claude --continue ignores ANTHROPIC_DEFAULT_OPUS_MODEL, resumes on 200K instead of configured 1M — wastes tokens on failed context load
Problem
When resuming a session with claude --continue, the CLI restores the model stored at session creation time instead of respecting the current ANTHROPIC_DEFAULT_OPUS_MODEL env var. If the original session was created before configuring claude-opus-4-6[1m], continuing it silently puts the user on the 200K context version.
Reproduction
- Set
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-6[1m]in~/.claude/settings.jsonenv block - Open a project that has an older session (created before this env var was set)
- Run
claude --continue→ resume full session - Hit
/model— observe option 5 "Opus 4.6 ✔" is selected (200K), NOT option 1 "Default — Opus 4.6 with 1M context" - Try to work → immediately hit "Context limit reached" because you're on 200K
Expected Behavior
--continue should either:
- Upgrade the model to match the current
ANTHROPIC_DEFAULT_OPUS_MODEL(preferred) - Or at minimum warn when the stored session model differs from the configured default
Current Behavior
--continue silently uses the stored claude-opus-4-6 (200K) model, ignoring the user's explicit configuration of claude-opus-4-6[1m] (1M). The user must manually /model → select option 1 after every --continue on older sessions.
Impact
Every --continue on a pre-1M session silently degrades to 200K context. The user configured the env var specifically to prevent this, but --continue bypasses it. This is especially confusing because new sessions correctly use 1M — only resumed sessions break.
Environment
- Claude Code v2.1.152
- macOS 24.6.0
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-6[1m]in~/.claude/settings.jsonenv block
7 Comments
Additional concern: wasted tokens on model mismatch
When
--continueresumes a session that was originally on 1M context but loads it on 200K (due to the stored model issue above), the full conversation history is sent to the API and tokens are consumed — only to immediately hit "Context limit reached."The user then switches to 1M via
/model→ Default, and the next prompt re-sends the entire conversation context to the 1M model. This means the conversation's context tokens are billed twice: once for the failed 200K attempt, once for the successful 1M attempt.Since the user was originally on 1M and is merely trying to resume that session, this token waste is entirely avoidable. The
--continuecommand should detect that the configured default (ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-6[1m]) differs from the stored session model and upgrade before sending any API calls.Confirming this reproduces for us too — on a different platform and a newer build, so it's not macOS-specific or limited to 4.6:
platform:macos, but we hit it on Windows/WSL.)claude-opus-4-7[1m]). New sessions correctly load "Opus 4.7 (1M context)".claude --continue/-rsilently restores the bare 200Kclaude-opus-4-7— the statusline drops the "(1M context)" label and the context gauge goes negative on a >200K transcript.[1m]extended-context flag regardless of the configured default. New chats need no override to get 1M; only resume breaks.Manual
/model→ Default after each resume is the only workaround we've found. +1 for "upgrade to the configured default (or at least warn)".Yes; this appears to be one of the consequences of a broader #63376
me too. Could you guys fix this bug ASAP? Thanks a lot.
Additional reproduction: opusplan mode + Databricks custom model names
Hitting the same root cause in a different scenario.
Setup:
ANTHROPIC_DEFAULT_HAIKU_MODEL=databricks-claude-haiku-4-5
ANTHROPIC_DEFAULT_OPUS_MODEL=databricks-claude-opus-4-7
ANTHROPIC_DEFAULT_SONNET_MODEL=databricks-claude-sonnet-4-6
settings.json → "model": "opusplan"
Steps:
Why: In opusplan mode, the sonnet leg stores the bare name claude-sonnet-4-6 in the session transcript. On resume, that bare name is used literally
— the ANTHROPIC_DEFAULT_SONNET_MODEL substitution is never applied — so the request goes out as claude-sonnet-4-6 instead of
databricks-claude-sonnet-4-6, which doesn't exist on our Databricks endpoint.
Same fix applies: session resume should re-apply ANTHROPIC_DEFAULT_* substitutions to any stored model name, same as initial model selection does.
Environment:
Workaround: writing /model opusplan manually when resuming a session.
Still reproduces on v2.1.186 (macOS 26.5.1, arm64, standalone installer), and it turns out to be broader than "ignores the configured 1M id" — the default 1M selection itself is dropped on resume, even with no model configuration at all.
Minimal repro (no env vars, no
settings.jsonmodel, no--modelflag)claudein an empty dir →/modelshows option 1 "Default (recommended) — Opus 4.8 with 1M context" selected; statusline reads "Opus 4.8 (1M context)". ✅claude --continue→/modelnow shows a new entry "Opus 4.8 ✔ (claude-opus-4-8)" selected = the 200k variant; the "(1M context)" label is gone. ❌ Working immediately hits "Context limit reached" on a large transcript.So this is not limited to sessions created before configuring a 1M id (the original framing here): a session that started on the plain default 1M also drops to 200k on resume.
One nuance that explains why it looks intermittent: a session that has not yet produced an assistant turn (still "thinking" on its first reply) resumes correctly at 1M — there's nothing recorded to reconstruct from. Only sessions that have already completed at least one turn drop to 200k.
Not proxy-specific
Reproduces both on pure first-party (direct to
api.anthropic.com) and through a customANTHROPIC_BASE_URL.Likely mechanism
The session journal only ever stores the bare response model id
claude-opus-4-8(never the[1m]suffix). On resume the model is reconstructed from that bare id and treated as an explicit 200k pick, so the 1M-context selection is lost. (Consistent with #64771 / #63376 and the closed-then-regressed #60548.)Automatable workaround
If you wrap or script Claude Code, launch the resume with
--model default:The
--modelflag uniquely (a) resolves thedefaultalias to the current 1M default (claude-opus-4-8[1m]) and (b) overrides the reconstructed session model. Notes from testing:ANTHROPIC_MODEL=defaultdoes not work — it's taken literally as a custom model named "default".--model opusresolves to the 200k plain variant, not 1M.--model defaultis version-agnostic, so it keeps tracking the recommended default across model updates.update your config
~/.claude/settings.jsonmaybe work also : @Gab-CosmoLabs @ANoginmore info: https://thinkycx.me/files/notes-pub/2026-07-09-claude-code-resume-model-bug-analysis-en-pub.md