{"record":{"id":"49f4bdddf584c1be","repo":"zed-industries/zed","slug":"this-anthropic-model-does-not-support-explicit-com","errorCode":null,"errorMessage":"this Anthropic model does not support explicit compaction","messagePattern":"this Anthropic model does not support explicit compaction","errorType":"exception","errorClass":"LanguageModelCompletionError","httpStatus":null,"severity":"error","filePath":"crates/language_models/src/provider/anthropic.rs","lineNumber":807,"sourceCode":"    }\n\n    fn supports_explicit_compaction(&self) -> bool {\n        self.model.supports_compaction\n    }\n\n    fn minimum_explicit_compaction_input_tokens(&self) -> Option<u64> {\n        self.supports_explicit_compaction()\n            .then_some(anthropic::MIN_COMPACTION_TRIGGER_TOKENS)\n    }\n\n    fn compact(\n        &self,\n        request: LanguageModelRequest,\n        cx: &AsyncApp,\n    ) -> BoxFuture<'static, Result<CompactionResult, LanguageModelCompletionError>> {\n        if !self.supports_explicit_compaction() {\n            return async {\n                Err(LanguageModelCompletionError::Other(anyhow::anyhow!(\n                    \"this Anthropic model does not support explicit compaction\"\n                )))\n            }\n            .boxed();\n        }\n\n        let mut request = match into_anthropic(\n            request,\n            self.model.request_id(false).to_string(),\n            self.model.default_temperature,\n            self.model.max_output_tokens,\n            self.model.mode.clone(),\n            AnthropicPromptCacheMode::Automatic,\n            &PROVIDER_ID,\n        ) {\n            Ok(request) => request.into_compact_request(),\n            Err(error) => return async move { Err(error.into()) }.boxed(),\n        };","sourceCodeStart":789,"sourceCodeEnd":825,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/language_models/src/provider/anthropic.rs#L789-L825","documentation":"Guard in AnthropicLanguageModel::compact: compact was invoked although `supports_explicit_compaction()` (driven by the model's supports_compaction flag) is false for this particular model, so provider-side explicit compaction cannot be performed. This is a capability check failure — the caller should have consulted supports_explicit_compaction/minimum_explicit_compaction_input_tokens before requesting compaction.","triggerScenarios":"Thrown at crates/language_models/src/provider/anthropic.rs:807 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check supports_explicit_compaction() before calling compact and fall back to client-side compaction","Select a different Anthropic model that has supports_compaction enabled","Update the model's capability metadata if it actually supports compaction but the flag is wrong"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}