{"record":{"id":"3cd326fd263c07cb","repo":"astrid-runtime/astrid","slug":"cannot-retire-legacy-capsule-authority-while-labe","errorCode":null,"errorMessage":"cannot retire legacy capsule authority while {label} transaction artifact exists at {}","messagePattern":"cannot retire legacy capsule authority while (.+?) transaction artifact exists at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority.rs","lineNumber":235,"sourceCode":"/// Remove the exact legacy authority receipt bound to one native capsule\n/// target after its durable package has been read back and verified.\n///\n/// The active receipt is compared byte-for-byte with the bytes that were\n/// published to the durable registry.  Pending or previous transaction\n/// artifacts are never guessed at or swept: they make retirement fail closed\n/// and remain on disk for recovery.  The authority directory is synced after\n/// unlinking so a crash cannot report retirement before the directory entry is\n/// durable.\npub(crate) fn retire_legacy_authority_receipt(\n    home: &AstridHome,\n    target_dir: &Path,\n    expected_bytes: &[u8],\n) -> anyhow::Result<()> {\n    let paths = authority_paths(home, target_dir)?;\n    for (label, path) in [(\"pending\", &paths.pending), (\"previous\", &paths.previous)] {\n        match std::fs::symlink_metadata(path) {\n            Ok(_metadata) => {\n                bail!(\n                    \"cannot retire legacy capsule authority while {label} transaction artifact exists at {}\",\n                    path.display()\n                );\n            },\n            Err(error) if error.kind() == std::io::ErrorKind::NotFound => {},\n            Err(error) => {\n                return Err(error).with_context(|| {\n                    format!(\n                        \"inspect legacy capsule authority {label} {}\",\n                        path.display()\n                    )\n                });\n            },\n        }\n    }\n\n    let metadata = std::fs::symlink_metadata(&paths.active).with_context(|| {\n        format!(","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority.rs#L217-L253","documentation":"Fired by retire_legacy_authority_receipt when pending or previous transaction artifacts still exist alongside the active receipt. Retirement refuses to guess at or sweep transactional state; artifacts are preserved on disk for recovery.","triggerScenarios":"Thrown at crates/astrid-capsule-install/src/authority.rs:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Complete or roll back the pending authority transaction first","Inspect the named artifact to decide recovery vs. discard","Re-run retirement after the transaction artifacts are resolved"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}