{"record":{"id":"122ce007afd31c7d","repo":"zed-industries/zed","slug":"unsupported-anthropic-compaction-state-format","errorCode":null,"errorMessage":"unsupported Anthropic compaction state format: {}","messagePattern":"unsupported Anthropic compaction state format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/anthropic/src/completion.rs","lineNumber":57,"sourceCode":"    ProviderCompactionState::new(\n        owner,\n        SharedString::new_static(COMPACTION_STATE_FORMAT),\n        encrypted_content,\n    )\n}\n\n/// Recovers the `encrypted_content` to round-trip from `state` if it is owned\n/// by `owner`, or `None` when the state belongs to a different backend and the\n/// summary should be replayed without it.\npub fn provider_compaction_encrypted_content(\n    state: &ProviderCompactionState,\n    owner: &LanguageModelProviderId,\n) -> Result<Option<Arc<str>>> {\n    if state.provider_id() != owner {\n        return Ok(None);\n    }\n    if state.format() != COMPACTION_STATE_FORMAT {\n        return Err(anyhow!(\n            \"unsupported Anthropic compaction state format: {}\",\n            state.format()\n        ));\n    }\n    Ok(Some(state.payload().into()))\n}\n\n/// Collects one paused compaction stream into replacement context and usage.\n///\n/// # Errors\n///\n/// Returns an error when the stream fails, ends without finalized replacement\n/// context, or reports that the provider abandoned compaction.\npub async fn collect_compaction_result(\n    mut stream: BoxStream<\n        'static,\n        Result<LanguageModelCompletionEvent, LanguageModelCompletionError>,\n    >,","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/anthropic/src/completion.rs#L39-L75","documentation":"provider_compaction_encrypted_content validates the compaction state's format tag against the current COMPACTION_STATE_FORMAT; an unknown/older format means the encrypted content cannot be trusted and the state is rejected.","triggerScenarios":"Thrown at crates/anthropic/src/completion.rs:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Persist compaction state only through the backend that produced it, and route compaction replay to that same backend","Re-compact the thread with the current provider to regenerate state in its expected format","Version the state format string and migrate or discard incompatible stored state instead of erroring mid-request"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}