astrid-runtime/astrid · error

distro declared capsule '{expected}', but the checked instal

Error message

distro declared capsule '{expected}', but the checked installer reported '{}'

What it means

After confirming the installer reported exactly one capsule, validate_batch_install compares the installed capsule's id to the distro-declared expected id. A mismatch means the installer installed a different capsule than the distro promised — a hard error guarding Distro.lock correctness.

Source

Thrown at crates/astrid-cli/src/commands/init.rs:861

) -> anyhow::Result<VerifiedBatchInstall> {
    if outcome.installed.len() != 1 {
        let actual = outcome
            .installed
            .iter()
            .map(|installed| installed.id.as_str())
            .collect::<Vec<_>>()
            .join(", ");
        bail!(
            "distro declared capsule '{expected}', but the checked installer reported [{actual}]"
        );
    }
    let installed = outcome
        .installed
        .into_iter()
        .next()
        .expect("length checked");
    if installed.id != *expected {
        bail!(
            "distro declared capsule '{expected}', but the checked installer reported '{}'",
            installed.id
        );
    }
    if !declared_version.is_empty() && installed.version != declared_version {
        bail!(
            "capsule '{expected}' release selector declared version {declared_version}, but the installed manifest reports {}",
            installed.version
        );
    }
    if let Some(expected_ref) = expected_ref
        && outcome.resolved_ref.as_deref() != Some(expected_ref)
    {
        bail!(
            "capsule '{expected}' signed ref {expected_ref} did not match installed ref {:?}",
            outcome.resolved_ref
        );
    }

View on GitHub (pinned to affd8760f4)

Solutions

  1. Re-run `astrid init` so the installer re-resolves against the current distro manifest.
  2. Check the distro's Distro.toml capsule id vs. the actual capsule name/id in the source repo.
  3. Update the distro manifest or the capsule so ids match, then retry.

Example fix

// before (Distro.toml)
[[capsules]]
id = "capsule-old"
// after
[[capsules]]
id = "capsule-renamed"
Defensive patterns

Strategy: try-catch

Validate before calling

if declared_id != installer_reported_id {
    eprintln!("manifest id {declared_id} != installer id {installer_reported_id}; update Distro.toml");
}

Try / catch

match validate_batch_install(&outcome, &expected, version) {
    Ok(installed) => record(installed),
    Err(e) => {
        eprintln!("capsule identity mismatch: {e:#}");
        // fix Distro.toml id or capsule name, then retry
    }
}

Prevention

When it happens

Trigger: validate_batch_install: outcome.installed has exactly one entry but installed.id != *expected — the single reported capsule id differs from the declared one.

Common situations: Distro manifest entry updated/renamed while a cached installer resolved an older capsule id; case-sensitivity or naming drift between the manifest and installer.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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