Skip to content

Claude "Prompt is too long" (terminal_reason blocking_limit) is shown as "Usage limit reached" #19832

Closed

Description

@maciekb

What happened

A long Claude (Opus 5.5) thread in the desktop app stopped with "Prompt is too long", and T3 Code showed "Usage limit reached." plus the banner "Usage limit reached · Reset time unavailable; retry manually". Every follow-up message ("kontynuuj", sent 3 times) failed the same way within ~40 ms. The plan was not usage-limited: the latest rate_limit_event reported status: "allowed" (5h window 73%, 7d window 40%). The real cause was a full context window (auto-compact was disabled in the user's Claude Code settings), so "retry manually" can never succeed and the UI does not point the user to /compact or a new thread.

Diagnosis

The Claude SDK ended the turn with terminal_reason: "blocking_limit", is_error: true, result: "Prompt is too long", and the synthetic assistant message carried error: "invalid_request". In this case blocking_limit meant the context blocking limit, not a plan or rate limit.

apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts treats every blocking_limit as a usage limit:

  • L2820: message.terminal_reason === "blocking_limit" || ... ? "usage_limit" : "provider_error" sets the failure class to usage_limit, which drives the "Usage limit reached" row, the warning banner and the usage-limit recovery/resume UI.
  • L2638: terminalResultError maps blocking_limit to "Claude stopped: a usage limit blocked the request."
  • ClaudeAdapterV2.test.ts:4644 asserts blocking_limit → usage_limit, so the mapping is locked in.

Suggested direction: don't classify blocking_limit as usage_limit on its own. Use usage_limit only when there is rate-limit evidence (api_error_status === 429, an assistant error: "rate_limit", or a rate_limit_event with a non-allowed status). When the result is "Prompt is too long" / error: "invalid_request", report a context-window failure (as prompt_too_long already is: "the prompt exceeds the model's context window") and offer /compact or a new thread.

Steps to reproduce

  1. In ~/.claude/settings.json set "autoCompactEnabled": false.
  2. In the T3 Code desktop app, run a Claude thread (Opus 5.5, 1M context) until the conversation fills the context window (here: 189 turns, a long refactor with many file reads and builds).
  3. When the turn fails, observe "Prompt is too long" followed by "Usage limit reached." and the "Usage limit reached · Reset time unavailable; retry manually" banner.
  4. Send any follow-up message: it fails immediately with the same pair of messages, while the provider's rate-limit state is allowed.

Version

0.0.46-nightly.20261015.3145 (desktop app, local server; tag commit 339179f, same as main at triage time)

Environment

macOS (Darwin 27.0.0, arm64), Node v26.8.2, @anthropic-ai/claude-agent-sdk 0.3.293, model claude-opus-5-5 (1M context)

Evidence

# provider/events.<thread>.log (trimmed)
08:36:10.675Z rate_limit_event  {"status":"allowed","rateLimitType":"five_hour","unifiedWindows":{"five_hour":{"utilization":0.73},"seven_day":{"utilization":0.4}}}
08:36:10.699Z assistant         {"model":"<synthetic>","content":[{"type":"text","text":"Prompt is too long"}],"error":"invalid_request","is_api_error_message":true}
08:36:10.710Z result            {"subtype":"success","is_error":true,"terminal_reason":"blocking_limit","api_error_status":null,"result":"Prompt is too long","num_turns":189}
08:38:00.634Z prompt.offer      "kontynuuj"
08:38:00.689Z assistant         {"model":"<synthetic>","text":"Prompt is too long","error":"invalid_request"}
08:38:00.695Z result            {"is_error":true,"terminal_reason":"blocking_limit","result":"Prompt is too long","duration_ms":37}
08:39:48.2xxZ (same again for the third "kontynuuj")

UI: "Prompt is too long" → "⚠ Usage limit reached." (×3), banner "Usage limit reached · Reset time unavailable; retry manually". A screenshot will be attached below.

Related issues

#10320 (a different Claude error misclassified: expired login or usage limit shown as "gave up after repeated API errors"; closed). #19823 (configurable compaction threshold, not about error classification). No existing issue covers blocking_limit / "Prompt is too long" being shown as a usage limit.

Fix applied or workaround

No code changes. Workaround: run /compact in the thread or start a new thread; re-enable autoCompactEnabled in ~/.claude/settings.json to avoid hitting the limit.

Filed by

Claude Code (Claude Opus 5.5, claude-opus-5-5) via t3 triage

Activity

  1. maciekb commented on Oct 15, 2026

    @maciekb
    Author
    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions