{"record":{"id":"8b4de91d5d12a110","repo":"astrid-runtime/astrid","slug":"distro-declared-capsule-expected-but-the-chec-8b4de9","errorCode":null,"errorMessage":"distro declared capsule '{expected}', but the checked installer reported '{}'","messagePattern":"distro declared capsule '(.+?)', but the checked installer reported '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/init.rs","lineNumber":861,"sourceCode":") -> anyhow::Result<VerifiedBatchInstall> {\n    if outcome.installed.len() != 1 {\n        let actual = outcome\n            .installed\n            .iter()\n            .map(|installed| installed.id.as_str())\n            .collect::<Vec<_>>()\n            .join(\", \");\n        bail!(\n            \"distro declared capsule '{expected}', but the checked installer reported [{actual}]\"\n        );\n    }\n    let installed = outcome\n        .installed\n        .into_iter()\n        .next()\n        .expect(\"length checked\");\n    if installed.id != *expected {\n        bail!(\n            \"distro declared capsule '{expected}', but the checked installer reported '{}'\",\n            installed.id\n        );\n    }\n    if !declared_version.is_empty() && installed.version != declared_version {\n        bail!(\n            \"capsule '{expected}' release selector declared version {declared_version}, but the installed manifest reports {}\",\n            installed.version\n        );\n    }\n    if let Some(expected_ref) = expected_ref\n        && outcome.resolved_ref.as_deref() != Some(expected_ref)\n    {\n        bail!(\n            \"capsule '{expected}' signed ref {expected_ref} did not match installed ref {:?}\",\n            outcome.resolved_ref\n        );\n    }","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/init.rs#L843-L879","documentation":"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.","triggerScenarios":"validate_batch_install: outcome.installed has exactly one entry but installed.id != *expected — the single reported capsule id differs from the declared one.","commonSituations":"Distro manifest entry updated/renamed while a cached installer resolved an older capsule id; case-sensitivity or naming drift between the manifest and installer.","solutions":["Re-run `astrid init` so the installer re-resolves against the current distro manifest.","Check the distro's Distro.toml capsule id vs. the actual capsule name/id in the source repo.","Update the distro manifest or the capsule so ids match, then retry."],"exampleFix":"// before (Distro.toml)\n[[capsules]]\nid = \"capsule-old\"\n// after\n[[capsules]]\nid = \"capsule-renamed\"","handlingStrategy":"try-catch","validationCode":"if declared_id != installer_reported_id {\n    eprintln!(\"manifest id {declared_id} != installer id {installer_reported_id}; update Distro.toml\");\n}","typeGuard":null,"tryCatchPattern":"match validate_batch_install(&outcome, &expected, version) {\n    Ok(installed) => record(installed),\n    Err(e) => {\n        eprintln!(\"capsule identity mismatch: {e:#}\");\n        // fix Distro.toml id or capsule name, then retry\n    }\n}","preventionTips":["Keep capsule ids in Distro.toml identical to the capsule's canonical name.","Rename capsule ids atomically in both the manifest and the source repo.","Re-run `astrid init` after manifest edits so both sides re-resolve."],"tags":["install","capsules","invariant","identity-mismatch"],"backgroundTag":"internal-invariant-violation","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}