{"record":{"id":"d2c38a2329738322","repo":"astrid-runtime/astrid","slug":"legacy-capsule-authority-receipt-changed-during-re","errorCode":null,"errorMessage":"legacy capsule authority receipt changed during retirement: {}","messagePattern":"legacy capsule authority receipt changed during retirement: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority.rs","lineNumber":287,"sourceCode":"    })?;\n    let actual = std::fs::read(&paths.active)\n        .with_context(|| format!(\"read legacy capsule authority {}\", paths.active.display()))?;\n    if actual != expected_bytes {\n        bail!(\n            \"legacy capsule authority receipt changed before retirement: {}\",\n            paths.active.display()\n        );\n    }\n    // Re-stat and re-read immediately before unlinking.  This does not turn a\n    // host filesystem into a transaction, but closes the ordinary mutation\n    // window exercised by migration/recovery and preserves a changed source.\n    let final_metadata = std::fs::symlink_metadata(&paths.active)?;\n    if final_metadata.file_type().is_symlink()\n        || !final_metadata.is_file()\n        || final_metadata.len() != actual.len() as u64\n        || std::fs::read(&paths.active)?.as_slice() != expected_bytes\n    {\n        bail!(\n            \"legacy capsule authority receipt changed during retirement: {}\",\n            paths.active.display()\n        );\n    }\n    std::fs::remove_file(&paths.active).with_context(|| {\n        format!(\n            \"retire legacy capsule authority receipt {}\",\n            paths.active.display()\n        )\n    })?;\n    sync_authority_directory(&paths.directory)\n}\n\nfn sync_authority_directory(directory: &Path) -> anyhow::Result<()> {\n    #[cfg(unix)]\n    {\n        File::open(directory)\n            .with_context(|| format!(\"open authority directory {}\", directory.display()))?","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority.rs#L269-L305","documentation":"Fired by retire_legacy_authority_receipt during the final re-stat/re-read immediately before unlinking: the receipt changed in the last-moment check. The unlink is aborted so a concurrently replaced receipt is preserved rather than deleted.","triggerScenarios":"Thrown at crates/astrid-capsule-install/src/authority.rs:287 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Stop concurrent capsule operations, then retry retirement","Investigate the competing writer (migration/recovery process)","Verify receipt integrity before retrying"],"exampleFix":null,"handlingStrategy":"retry","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"}