[BUG] /context reports 222% of model limit with self-inconsistent breakdown, causing immediate "Prompt is too long" on a fresh session

Status Open
Reported on v2.1.228
Maintainer reply None cached
Activity 0 comments · opened Aug 12, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

A newly started Claude Code session — no prior work performed, /compact never run — immediately failed with Prompt is too long. Running /context showed usage at 444.1k / 200.0k tokens (222%), more than double the model's stated context limit. Additionally, the displayed category breakdown does not sum to the reported total: Skills (2.4k) + Messages (164.6k) + Autocompact buffer (33.0k) = 200.0k exactly, but the reported total is 444.1k — leaving roughly 244k tokens unaccounted for in the visible categories.

What Should Happen?

/context usage should never exceed 100% of the model's stated limit — auto-compact is expected to intervene before the hard limit is reached, and a client-side block should not allow the reported figure to reach 222%. If usage does approach or reach the limit, the category breakdown shown should sum to (or closely approximate) the reported total, so the user can identify what is actually consuming context. A brand-new session with no prior work should never begin already over its context limit.

Error Messages/Logs

Chat-level error: `Prompt is too long`

`/context` output:

claude-opus-5 — 444.1k / 200.0k tokens (222%)

Skills:              2.4k   (1.2%)
Messages:          164.6k  (82.3%)
Autocompact buffer:  33.0k  (16.5%)

Memory files and Custom agents rows were visible in the panel but displayed "0" in the token column — possibly a UI truncation artifact from horizontal scrolling in the panel rather than genuinely zero; flagging as unconfirmed rather than asserting the cause.

Steps to Reproduce

  1. On a Claude Pro plan, Claude Code VS Code extension + Devcontainer, immediately after a 5-hour usage window reset.
  2. Start a new session using claude-opus-5.
  3. Run /context before performing any substantial work.
  4. Observe usage already reported above 100% (222% observed in this instance), with the category breakdown not summing to the reported total.
  5. Sending any prompt in this state immediately returns Prompt is too long, even for a short message.

Already attempted before filing this report: claude update, full VS Code extension restart, claude doctor (reported no issues found). The problem persisted after all three remediation steps.

Second, distinct reproduction path (observed separately, on a different occasion)

On a separate occasion — not the same session as the primary scenario above — the same Prompt is too long symptom occurred through a different trigger, involving two accounts (A1, A2):

  1. Account A1 hit its 5-hour session usage limit while in the middle of an in-progress task.
  2. To keep working, switched to a second Claude account (A2) by configuring a separate CLAUDE_CONFIG_DIR per VS Code Profile — i.e., a distinct VS Code Profile is set up per account, each with its own CLAUDE_CONFIG_DIR value, rather than switching accounts via /logout//login.
  3. Continued the same in-progress conversation/task under the A2 profile (did not start a brand-new session) — this immediately produced Prompt is too long.
  4. By contrast, starting a completely new session under the A2 profile (instead of continuing the in-progress one) did not reproduce the error — but instead prompted for login, as if A2 had no valid existing session in that profile's config directory yet.

This suggests that continuing an in-progress conversation across a profile switch may carry over context/session state associated with A1 (potentially including a larger context-window entitlement, e.g. claude-opus-5[1m]) into a request now being evaluated under A2's identity/entitlement (claude-opus-5, standard 200k) — which would explain an immediate, large overflow on the very first message sent after switching. This has not been confirmed against internal implementation details and is offered as a hypothesis, not a confirmed cause.

Note: this cross-account path was confirmed to apply to only this one occurrence, not the primary occurrence(s) described above in "Steps to Reproduce," which happened on a single account with no profile/account switching involved. The two are believed to be separate reproduction paths converging on the same symptom, and are both included here since they may share a root cause in how context/session state is scoped and validated against the active account's entitlements.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code VS Code extension , ver: 2.1.228

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

  • Environment: Claude Pro plan; Claude Code VS Code extension + Devcontainer; custom CLAUDE_CONFIG_DIR in use (non-default .claude-work) for the primary scenario, and per-VS-Code-Profile CLAUDE_CONFIG_DIR values (one per account) for the second reproduction path.
  • Model shown in the primary scenario is claude-opus-5 (standard 200k context window), differing from claude-opus-5[1m] (1M window) observed in a related session from the same overall setup — noting in case model-variant handling is relevant to the accounting discrepancy, and possibly directly relevant to the second reproduction path (see hypothesis above).
  • Correction/update to prior assumption: it was previously assumed the VS Code extension does not read CLAUDE_CONFIG_DIR at all (based on a then-open feature request). The second reproduction path above suggests VS Code Profile-scoped CLAUDE_CONFIG_DIR values do influence identity/session behavior in some way (continuing vs. starting new produced different outcomes) — this discrepancy itself may be worth the Anthropic team's attention, independent of the context-overflow symptom.
  • The login prompt observed when starting a brand-new session under a not-previously-authenticated profile may simply be expected first-time-auth behavior rather than a bug — included here for completeness since it is part of the same observed sequence, not because it is independently suspected to be incorrect.
  • This occurred in the session immediately following the reset referenced in the related issue "Session (5hr) usage limit exhausted within minutes on a lightweight document-edit task." Filed separately since the two present as distinct symptoms (usage-limit exhaustion vs. context-window overflow with self-inconsistent reporting), but noting the possible connection in case they share a root cause.
  • The /bug command is not available in the Claude Code VS Code extension, which is why this is being filed directly as a GitHub issue.

View original on GitHub ↗