{"record":{"id":"ab1bea3ed91f57d7","repo":"astrid-runtime/astrid","slug":"capsule-version-mismatch-for-expected-expecte-ab1bea","errorCode":null,"errorMessage":"capsule version mismatch for '{expected}': expected '{expected_version}', manifest declares '{}'","messagePattern":"capsule version mismatch for '(.+?)': expected '(.+?)', manifest declares '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/local.rs","lineNumber":515,"sourceCode":") -> anyhow::Result<InstallOutput> {\n    let inspection = inspect_directory_for_principal_in_workspace(\n        source_dir,\n        home,\n        target_principal,\n        options.workspace,\n        workspace_root,\n        workspace_layout,\n    )?;\n    if inspection.capsule_id != *expected {\n        bail!(\n            \"capsule identity mismatch: expected '{expected}', manifest declares '{}'\",\n            inspection.capsule_id\n        );\n    }\n    if let Some(expected_version) = expected_version\n        && inspection.version != expected_version\n    {\n        bail!(\n            \"capsule version mismatch for '{expected}': expected '{expected_version}', manifest declares '{}'\",\n            inspection.version\n        );\n    }\n    let authority = authorize_install(&inspection, decision)?;\n    install_from_local_path_internal(\n        source_dir,\n        home,\n        options,\n        target_principal,\n        InstallWorkspace {\n            root: workspace_root,\n            layout: workspace_layout,\n        },\n        Some(ExpectedCapsuleIdentity {\n            id: expected,\n            version: expected_version,\n        }),","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/local.rs#L497-L533","documentation":"This error is raised when the capsule id matches but the manifest's declared version differs from the expected_version supplied by the caller. install_from_local_path_checked_authorized_for_principal_in_workspace pins the exact version that was approved for installation; installing any other version would bypass version-based authorization, so the operation bails before mutating the target. It is the version-half of the identity check begun at the capsule id comparison.","triggerScenarios":"Calling install_from_local_path_checked_authorized_for_principal_with_layout with Some(expected_version) where the version in the source Capsule.toml (manifest.package.version) differs, e.g. expected 1.2.0 but the directory contains 1.3.0 after an upgrade.","commonSituations":"The local checkout was updated/rebased to a newer version after approval; a semver bump landed in the manifest; pinning an old version while pointing at a workspace directory already bumped; Cargo-style version edits not propagated to the caller.","solutions":["Compare expected_version against package.version in the source Capsule.toml","Update the expected version to the manifest's current version and re-run authorization, or pin the source directory to the approved version (git checkout the approved tag/commit)","If the newer version is intended, re-run the install flow so the approval covers the new version","Ensure no automated tooling bumps package.version between approval and install"],"exampleFix":"// before\ninstall_..._with_layout(&src, &id, Some(Version::parse(\"1.2.0\")?), ...)?;\n// after\nlet manifest: Manifest = toml::from_str(&std::fs::read_to_string(src.join(\"Capsule.toml\"))?)?;\ninstall_..._with_layout(&src, &id, Some(manifest.package.version.clone()), ...)?;","handlingStrategy":"validation","validationCode":"fn ensure_expected_version(src: &Path, expected: &Version) -> anyhow::Result<()> {\n    let manifest: Manifest = toml::from_str(&std::fs::read_to_string(src.join(\"Capsule.toml\"))?)?;\n    anyhow::ensure!(manifest.package.version == *expected, \"version drift: {} vs {expected}\", manifest.package.version);\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = install_..._checked_authorized(...) {\n    if e.to_string().contains(\"capsule version mismatch\") {\n        // re-read manifest version and re-run authorization for that version\n    } else { return Err(e); }\n}","preventionTips":["Pin the source tree (git tag/commit) at the approved version before installing","Re-run approval whenever package.version changes","Watch for release automation bumping versions between approval and install","Log both versions on failure for quick diagnosis"],"tags":["capsule-install","version-mismatch","manifest"],"backgroundTag":"version-mismatch","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}