{"record":{"id":"3ec88d70496238e8","repo":"zed-industries/zed","slug":"unsupported-openai-compaction-state-format","errorCode":null,"errorMessage":"unsupported OpenAI compaction state format: {}","messagePattern":"unsupported OpenAI compaction state format: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/open_ai/src/responses.rs","lineNumber":133,"sourceCode":"    Ok(ProviderCompactionState::new(\n        owner,\n        SharedString::new_static(COMPACTION_STATE_FORMAT),\n        serde_json::to_string(&items)?,\n    ))\n}\n\n/// Recovers the canonical replacement window from `state` if it is owned by\n/// `owner`, or `None` when the state belongs to a different backend and the\n/// caller should fall back to replaying the full transcript.\npub fn provider_compaction_items(\n    state: &ProviderCompactionState,\n    owner: &LanguageModelProviderId,\n) -> Result<Option<Vec<Value>>> {\n    if state.provider_id() != owner {\n        return Ok(None);\n    }\n    if state.format() != COMPACTION_STATE_FORMAT {\n        return Err(anyhow!(\n            \"unsupported OpenAI compaction state format: {}\",\n            state.format()\n        ));\n    }\n\n    let items = serde_json::from_str::<Vec<Value>>(state.payload())\n        .context(\"malformed OpenAI compaction state payload\")?;\n    validate_compaction_items(&items)?;\n    Ok(Some(items))\n}\n\nfn validate_compaction_items(items: &[Value]) -> Result<()> {\n    if items.is_empty() {\n        return Err(anyhow!(\"OpenAI returned an empty compaction output\"));\n    }\n    if !items.iter().any(|item| {\n        item.get(\"type\")\n            .and_then(Value::as_str)","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/open_ai/src/responses.rs#L115-L151","documentation":"Format guard in provider_compaction_items: the stored ProviderCompactionState was written by this backend but carries an unrecognized COMPACTION_STATE_FORMAT version, so its payload cannot be safely interpreted. The canonical replacement window is unavailable to the caller.","triggerScenarios":"Thrown at crates/open_ai/src/responses.rs:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fall back to replaying the full transcript (the caller's intended alternative)","Update Zed if the state was written by a newer version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}