Skip to content

"Input is too long for requested model" not classified as context_exceeded #1702

@ethanndickson

Description

@ethanndickson

Summary

When Anthropic returns an error with message "Input is too long for requested model", it's classified as api instead of context_exceeded. This prevents users from seeing the compaction suggestion UI.

Root Cause

In src/node/services/streamManager.ts, the categorizeError function inside the APICallError.isInstance() block only checks for one pattern:

// Check for Anthropic context exceeded errors
if (error.message.includes("prompt is too long:")) {
  return "context_exceeded";
}

return "api";  // Falls through here!

The actual error message "Input is too long for requested model" doesn't match "prompt is too long:", so it returns "api" and never reaches the generic string matching below that would catch "too long".

Impact

  • Error shows API badge instead of context_exceeded
  • User doesn't see the compaction suggestion UI
  • User is stuck with no guidance on how to recover

Generated with mux

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions