zed-industries/zed · error

unsupported Anthropic compaction state format: {}

Error message

unsupported Anthropic compaction state format: {}

What it means

Anthropic thread compaction can be resumed using provider-encrypted state (encrypted_content). provider_compaction_encrypted_content checks that the stored state belongs to Anthropic (provider_id matches) and that its format tag equals COMPACTION_STATE_FORMAT. A mismatch means the state was written by code using a different format version, so it cannot be safely decoded and the request cannot be built.

Source

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

    ProviderCompactionState::new(
        owner,
        SharedString::new_static(COMPACTION_STATE_FORMAT),
        encrypted_content,
    )
}

/// Recovers the `encrypted_content` to round-trip from `state` if it is owned
/// by `owner`, or `None` when the state belongs to a different backend and the
/// summary should be replayed without it.
pub fn provider_compaction_encrypted_content(
    state: &ProviderCompactionState,
    owner: &LanguageModelProviderId,
) -> Result<Option<Arc<str>>> {
    if state.provider_id() != owner {
        return Ok(None);
    }
    if state.format() != COMPACTION_STATE_FORMAT {
        return Err(anyhow!(
            "unsupported Anthropic compaction state format: {}",
            state.format()
        ));
    }
    Ok(Some(state.payload().into()))
}

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum AnthropicPromptCacheMode {
    Disabled,
    Legacy,
    #[default]
    Automatic,
}

fn set_cache_control(content: &mut RequestContent, cache_control: Option<CacheControl>) -> bool {
    match content {
        RequestContent::RedactedThinking { .. } => false,

View on GitHub (pinned to bc538def45)

Solutions

  1. Upgrade Zed to the version that wrote the state (or the latest release) and reopen the thread.
  2. Start a new conversation or trigger a fresh compaction so the state is rewritten in the current format.
  3. As a developer: when changing COMPACTION_STATE_FORMAT, write a migration for old payloads instead of erroring on read.
Defensive patterns

Strategy: validation

Validate before calling

if state.provider_id() == owner && state.format() != COMPACTION_STATE_FORMAT {
    // do not call provider_compaction_encrypted_content;
    // prompt for a new conversation or a fresh compaction instead
}

Type guard

fn is_decodable_compaction_state(
    state: &ProviderCompactionState,
    owner: &LanguageModelProviderId,
) -> bool {
    state.provider_id() == owner && state.format() == COMPACTION_STATE_FORMAT
}

Prevention

When it happens

Trigger: Loading a persisted conversation whose compaction state was serialized by a different Zed version (after upgrade or downgrade); a state row whose format tag changed or was corrupted; format evolution without a migration path.

Common situations: Rolling Zed back after an upgrade; opening old local thread databases; forward/backward migrations that changed the compaction-state format string.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/122ce007afd31c7d. Report an issue: GitHub.