astrid-runtime/astrid · error

cannot retire legacy capsule authority while

Error message

cannot retire legacy capsule authority while {label} transaction artifact exists at {}

What it means

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.

Solutions

  1. Complete or roll back the pending authority transaction first
  2. Inspect the named artifact to decide recovery vs. discard
  3. Re-run retirement after the transaction artifacts are resolved
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/astrid-capsule-install/src/authority.rs:235 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/3cd326fd263c07cb. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-capsule-install/src/authority.rs:235

/// Remove the exact legacy authority receipt bound to one native capsule
/// target after its durable package has been read back and verified.
///
/// The active receipt is compared byte-for-byte with the bytes that were
/// published to the durable registry.  Pending or previous transaction
/// artifacts are never guessed at or swept: they make retirement fail closed
/// and remain on disk for recovery.  The authority directory is synced after
/// unlinking so a crash cannot report retirement before the directory entry is
/// durable.
pub(crate) fn retire_legacy_authority_receipt(
    home: &AstridHome,
    target_dir: &Path,
    expected_bytes: &[u8],
) -> anyhow::Result<()> {
    let paths = authority_paths(home, target_dir)?;
    for (label, path) in [("pending", &paths.pending), ("previous", &paths.previous)] {
        match std::fs::symlink_metadata(path) {
            Ok(_metadata) => {
                bail!(
                    "cannot retire legacy capsule authority while {label} transaction artifact exists at {}",
                    path.display()
                );
            },
            Err(error) if error.kind() == std::io::ErrorKind::NotFound => {},
            Err(error) => {
                return Err(error).with_context(|| {
                    format!(
                        "inspect legacy capsule authority {label} {}",
                        path.display()
                    )
                });
            },
        }
    }

    let metadata = std::fs::symlink_metadata(&paths.active).with_context(|| {
        format!(

View on GitHub (pinned to affd8760f4)