Skip to content

fix: Add Anthropic error pattern for context window detection#4371

Open
npkanaka wants to merge 2 commits intocrewAIInc:mainfrom
npkanaka:fix/add-anthropic-context-error-pattern
Open

fix: Add Anthropic error pattern for context window detection#4371
npkanaka wants to merge 2 commits intocrewAIInc:mainfrom
npkanaka:fix/add-anthropic-context-error-pattern

Conversation

@npkanaka
Copy link

@npkanaka npkanaka commented Feb 4, 2026

When using Anthropic/Claude models with respect_context_window=True, context window errors are not detected because Anthropic's error message format doesn't match the existing patterns.

Anthropic error format: "prompt is too long: 210094 tokens > 200000 maximum"

Solution

Add "prompt is too long" to CONTEXT_LIMIT_ERRORS list to support Anthropic/Claude error detection.


Note

Low Risk
Single-string match extension to error detection; minimal behavioral change limited to recognizing additional context-limit errors.

Overview
Improves context-window overflow detection by extending CONTEXT_LIMIT_ERRORS with the Anthropic/Claude error pattern "prompt is too long", so LLMContextLengthExceededError classification triggers for Claude-style token limit messages (e.g., when respect_context_window=True).

Written by Cursor Bugbot for commit baf0be2. This will update automatically on new commits. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant