zed-industries/zed · error · LanguageModelCompletionError

this Anthropic model does not support explicit compaction

Error message

this Anthropic model does not support explicit compaction

What it means

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.

Source

Thrown at crates/language_models/src/provider/anthropic.rs:807

    }

    fn supports_explicit_compaction(&self) -> bool {
        self.model.supports_compaction
    }

    fn minimum_explicit_compaction_input_tokens(&self) -> Option<u64> {
        self.supports_explicit_compaction()
            .then_some(anthropic::MIN_COMPACTION_TRIGGER_TOKENS)
    }

    fn compact(
        &self,
        request: LanguageModelRequest,
        cx: &AsyncApp,
    ) -> BoxFuture<'static, Result<CompactionResult, LanguageModelCompletionError>> {
        if !self.supports_explicit_compaction() {
            return async {
                Err(LanguageModelCompletionError::Other(anyhow::anyhow!(
                    "this Anthropic model does not support explicit compaction"
                )))
            }
            .boxed();
        }

        let mut request = match into_anthropic(
            request,
            self.model.request_id(false).to_string(),
            self.model.default_temperature,
            self.model.max_output_tokens,
            self.model.mode.clone(),
            AnthropicPromptCacheMode::Automatic,
            &PROVIDER_ID,
        ) {
            Ok(request) => request.into_compact_request(),
            Err(error) => return async move { Err(error.into()) }.boxed(),
        };

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check supports_explicit_compaction() before calling compact and fall back to client-side compaction
  2. Select a different Anthropic model that has supports_compaction enabled
  3. Update the model's capability metadata if it actually supports compaction but the flag is wrong
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/language_models/src/provider/anthropic.rs:807 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/49f4bdddf584c1be. Report an issue: GitHub.