zed-industries/zed · error

Compaction produced an empty summary

Error message

Compaction produced an empty summary

What it means

Post-compaction sanity check in Thread: the summarization request completed but yielded an empty summary. Rather than replacing history with nothing (which would lose all context), the compaction fails with this error.

Solutions

  1. Retry compaction; transient model failures can produce empty summaries
  2. Check the model's availability and that it supports summarization-style prompts
  3. Reduce the history size or compact in smaller chunks if the model keeps returning empty output
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/agent/src/thread.rs:3226 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-09-19). Data as JSON: /api/errors/ac32d939fe9beb94. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent/src/thread.rs:3267

                    | LanguageModelCompletionEvent::Thinking { .. }
                    | LanguageModelCompletionEvent::RedactedThinking { .. }
                    | LanguageModelCompletionEvent::ReasoningDetails(_)
                    | LanguageModelCompletionEvent::ToolUse(_)
                    | LanguageModelCompletionEvent::ToolUseJsonParseError { .. }
                    | LanguageModelCompletionEvent::StartMessage { .. }
                    | LanguageModelCompletionEvent::Compaction(_) => {}
                }
            }

            if *cancellation_rx.borrow() {
                log::debug!("Compaction cancelled after summarizing");
                return Ok(ControlFlow::Break(()));
            }

            let summary = summary.trim().to_string();
            if summary.is_empty() {
                log::warn!("Compaction produced an empty summary");
                return Err(anyhow::anyhow!("Compaction produced an empty summary"));
            }

            log::debug!("Compaction succeeded:\n{summary}");
            event_stream.update_context_compaction_status(
                compaction_id.clone(),
                acp_thread::ContextCompactionStatus::Completed,
            );

            this.update(cx, |this, cx| {
                let compaction =
                    Arc::new(Message::Compaction(CompactionInfo::Summary(summary.into())));
                match insertion {
                    CompactionInsertion::Auto { insertion_ix } => {
                        if insertion_ix <= this.messages.len() {
                            this.messages.insert(insertion_ix, compaction);
                        } else {
                            this.messages.push(compaction);
                        }

View on GitHub (pinned to 916fc2b8cb)