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
Summary
When Anthropic returns an error with message "Input is too long for requested model", it's classified as
apiinstead ofcontext_exceeded. This prevents users from seeing the compaction suggestion UI.Root Cause
In
src/node/services/streamManager.ts, thecategorizeErrorfunction inside theAPICallError.isInstance()block only checks for one pattern: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
APIbadge instead ofcontext_exceededGenerated with
mux