Hmbown/CodeWhale · error

Compaction summary response was unusable: no text was…

Error message

Compaction summary response was unusable: no text was returned.

What it means

validate_compaction_summary bails when the model's summary response is empty after trimming whitespace. A compaction summary must provide usable continuation text; an empty response cannot serve as a checkpoint for the compacted conversation, so compaction aborts.

Solutions

  1. Retry compaction — transient provider issues often resolve
  2. Check provider status/credentials and rate limits
  3. Verify the model configured for compaction actually produces text output
  4. Manually start a fresh session if compaction keeps failing
Defensive patterns

Strategy: retry

Validate before calling

if (!resp.choices?.[0]?.message?.content?.trim()) {
  throw new Error('empty compaction summary');
}

Type guard

const hasText = (s: string | null | undefined): s is string =>
  typeof s === 'string' && s.trim().length > 0;

Try / catch

let summary = loop { match summarize().await { Ok(s) if !s.trim().is_empty() => break s, _ => continue } };

Prevention

When it happens

Trigger: The LLM returns an empty string or only whitespace as its compaction summary — e.g. a provider outage returning empty bodies, a truncated/malformed completion, or the model hitting an output token limit before emitting text.

Common situations: Provider-side failures during long-context summarization requests; rate-limited or degraded API responses; model misconfiguration producing no output.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/cee0ae934da6baf5. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/compaction.rs:1508

evidence, unresolved failures, and the single next action. Do not refuse, call tools, discuss \
checkpoint machinery, or return a placeholder. {COMPACTION_LANGUAGE_CONTRACT}"
    );
    if let Some(section) = operator_instructions_section(instructions) {
        prompt.push_str(&section);
    }
    if let Some(focus) = focus.map(str::trim).filter(|focus| !focus.is_empty()) {
        let _ = write!(
            prompt,
            "\n\nThe user asked this compaction to focus on: {focus}"
        );
    }
    prompt
}

fn validate_compaction_summary(summary: &str) -> Result<()> {
    let trimmed = summary.trim();
    if trimmed.is_empty() {
        anyhow::bail!("Compaction summary response was unusable: no text was returned.");
    }

    // Strip every non-word edge, not just ASCII punctuation. Providers can
    // return visually non-empty Unicode punctuation or emoji-only payloads;
    // neither is a usable continuation checkpoint. `is_alphanumeric` keeps
    // this language-neutral for CJK and other scripts without imposing a
    // prose-length heuristic.
    let normalized = trimmed
        .trim_matches(|ch: char| !ch.is_alphanumeric())
        .to_ascii_lowercase();
    if normalized.is_empty() {
        anyhow::bail!(
            "Compaction summary response was unusable: only whitespace or punctuation was returned."
        );
    }
    if matches!(
        normalized.as_str(),
        "no summary available"

View on GitHub (pinned to 73e0f67d83)