{"record":{"id":"c872ec28a343c33d","repo":"astrid-runtime/astrid","slug":"capsule-expected-release-selector-declared-ver","errorCode":null,"errorMessage":"capsule '{expected}' release selector declared version {declared_version}, but the installed manifest reports {}","messagePattern":"capsule '(.+?)' release selector declared version (.+?), but the installed manifest reports (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/init.rs","lineNumber":867,"sourceCode":"            .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    }\n    Ok(VerifiedBatchInstall {\n        version: installed.version,\n        wasm_hash: installed.wasm_hash,\n        resolved_ref: outcome.resolved_ref,\n        skipped: installed.skipped,\n    })","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/init.rs#L849-L885","documentation":"validate_batch_install verifies that each capsule installed by a batch/distro install matches what the distro declared. When the distro's release selector declared a specific version but the installer's resulting manifest reports a different version, it bails with this message. This guards against installing a capsule other than the pinned release (e.g. because a registry served a different artifact or the selector was resolved incorrectly).","triggerScenarios":"Running a batch install (via install_capsules_with_resume) where Distro.toml declares a non-empty version for a capsule and the installed Capsule.toml manifest's version differs from declared_version.","commonSituations":"A distro pins capsule version 1.2.0 but the registry resolves/installs 1.3.0; a stale cache or mirror serves an older/newer capsule; the distro file was hand-edited to a version that no longer matches published artifacts.","solutions":["Compare the declared version in the distro's release selector with the version in the installed capsule's manifest and align them (usually update the distro pin to the version actually published).","Clear any capsule/install cache and rerun the batch install so the correct pinned artifact is fetched.","If the installed version is correct, update Distro.toml's declared version to match, then rerun init.","Check the registry/index for the pinned version's availability; if it was yanked, pick an existing version."],"exampleFix":"// before (Distro.toml)\n[[releases]]\nname = \"codegen\"\nversion = \"1.2.0\"   # no longer published; installer resolved 1.3.0\n// after\n[[releases]]\nname = \"codegen\"\nversion = \"1.3.0\"","handlingStrategy":"validation","validationCode":"// before install\nlet declared = release.selector.version.as_deref().unwrap_or(\"\");\nif !declared.is_empty() {\n    // resolve the artifact version from the registry first and compare\n    assert_eq!(resolved.version, declared, \"distro pin {} != registry {}\", declared, resolved.version);\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"declared version\") => eprintln!(\"pin/registry drift: {e}; update Distro.toml\"),\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Keep distro version pins generated/updated by tooling, not by hand.","Refresh registries/caches before installs so resolution matches the pin.","Pin exact versions and verify published artifacts exist for each pin.","Run init in CI to catch pin drift early."],"tags":["version-mismatch","capsule-install","validation"],"backgroundTag":"invalid-argument-value","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"}