zed-industries/zed · error · LanguageModelCompletionError

{provider_name} abandoned compaction without producing repla

Error message

{provider_name} abandoned compaction without producing replacement context

What it means

collect_compaction_result drains an Anthropic compaction stream and never received a CompactionUpdate::Finished event before the stream ended; the provider stopped without delivering a replacement summary, so the old context would be lost if compaction were applied, and the error names the offending provider.

Source

Thrown at crates/anthropic/src/completion.rs:88

/// context, or reports that the provider abandoned compaction.
pub async fn collect_compaction_result(
    mut stream: BoxStream<
        'static,
        Result<LanguageModelCompletionEvent, LanguageModelCompletionError>,
    >,
    provider_name: LanguageModelProviderName,
) -> Result<(CompactedContext, TokenUsage), LanguageModelCompletionError> {
    let mut context = None;
    let mut usage = TokenUsage::default();
    while let Some(event) = stream.next().await {
        match event? {
            LanguageModelCompletionEvent::Compaction(CompactionUpdate::Finished(
                compacted_context,
            )) => {
                context = Some(compacted_context);
            }
            LanguageModelCompletionEvent::Compaction(CompactionUpdate::Failed) => {
                return Err(LanguageModelCompletionError::Other(anyhow!(
                    "{provider_name} abandoned compaction without producing replacement context"
                )));
            }
            LanguageModelCompletionEvent::UsageUpdate(updated_usage) => {
                usage = updated_usage;
            }
            LanguageModelCompletionEvent::Stop(_) => {
                return context.map(|context| (context, usage)).ok_or(
                    LanguageModelCompletionError::StreamEndedUnexpectedly {
                        provider: provider_name,
                    },
                );
            }
            LanguageModelCompletionEvent::Queued { .. }
            | LanguageModelCompletionEvent::Started
            | LanguageModelCompletionEvent::Text(_)
            | LanguageModelCompletionEvent::Thinking { .. }
            | LanguageModelCompletionEvent::RedactedThinking { .. }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Retry the compaction request — transient provider cutoffs usually succeed on a second attempt
  2. Keep the original (uncompacted) context on failure so the conversation can continue with full history
  3. If it recurs persistently, fall back to local (client-side) summarization of the thread
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/anthropic/src/completion.rs:88 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/352611ee52444bd2. Report an issue: GitHub.