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
- Upgrade Zed to the version that wrote the state (or the latest release) and reopen the thread.
- Start a new conversation or trigger a fresh compaction so the state is rewritten in the current format.
- 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
- Version compaction state and write migrations whenever COMPACTION_STATE_FORMAT changes.
- Include the writer version in the payload for diagnostics.
- On load failure, guide the user to start a new thread instead of retrying the same state.
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
- Anthropic streamed a compaction delta before starting its co
- Anthropic ended the stream without finishing its compaction
- Could not find UNIT_DATA in the file
- Failed to parse UNIT_DATA as JSON: ${e.message}
- HTTP error! status: ${response.status}
AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16).
Data as JSON: /api/errors/122ce007afd31c7d.
Report an issue: GitHub.