{"record":{"id":"272d0979b3b300bb","repo":"astrid-runtime/astrid","slug":"installed-capsule-identity-version-differs-from-it","errorCode":null,"errorMessage":"installed capsule identity/version differs from its authority receipt (approved {} {}, found {} {})","messagePattern":"installed capsule identity/version differs from its authority receipt \\(approved (.+?) (.+?), found (.+?) (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/authority.rs","lineNumber":559,"sourceCode":"            signature: None,\n            approved_capabilities: manifest.capabilities.clone(),\n            wasm_hash_pinned: true,\n            approved_wasm_hash: executable_hash,\n        };\n        AuthorityReceiptTransaction::stage(home, target_dir, &migrated)?.commit()?;\n        return Ok(());\n    };\n    let mut authority = authority;\n    if authority.schema_version != 1 {\n        bail!(\n            \"unsupported installed authority schema {}\",\n            authority.schema_version\n        );\n    }\n    if authority.capsule_id != manifest.package.name\n        || authority.version != manifest.package.version\n    {\n        bail!(\n            \"installed capsule identity/version differs from its authority receipt (approved {} {}, found {} {})\",\n            authority.capsule_id,\n            authority.version,\n            manifest.package.name,\n            manifest.package.version\n        );\n    }\n    let expansions = manifest\n        .capabilities\n        .expansions_from(&authority.approved_capabilities);\n    if !expansions.is_empty() {\n        let details = expansions\n            .into_iter()\n            .map(|expansion| format!(\"{}=[{}]\", expansion.name, expansion.added.join(\", \")))\n            .collect::<Vec<_>>()\n            .join(\"; \");\n        bail!(\n            \"manifest exceeds its installed capability approval: {details}; reinstall and approve the expansion\"","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/authority.rs#L541-L577","documentation":"Verification compares the capsule_id and version recorded in the installed authority receipt against the capsule manifest actually found on disk. If either differs, the installed files no longer correspond to what was approved at install time, so the mismatch is rejected. This guards against swapping capsule contents without re-approval.","triggerScenarios":"verify_installed_authority encounters authority.capsule_id != manifest.package.name or authority.version != manifest.package.version — e.g. the capsule directory was overwritten with a different capsule/version after approval.","commonSituations":"Manually replacing a capsule's files or Capsule.toml after install; installing a new version over the old directory without re-running the authorized install flow; copy/paste of capsule directories across projects.","solutions":["Reinstall the capsule via the authorized install path so a fresh receipt matching the current manifest is written","Restore the original capsule version that the receipt approves","If intentional, remove the old authority receipt and approve the new identity/version explicitly"],"exampleFix":"// before\n// capsule dir overwritten with v2 files, receipt still says v1\nverify_installed_authority(&home, &target_dir, &manifest, None)?;\n// after\nunpack_and_install_authorized_for_principal_in_workspace(/* reinstalls v2 with new receipt */)?;","handlingStrategy":"validation","validationCode":"let m = read_installed_manifest(&target_dir)?;\nlet a = read_authority_receipt(&home, &target_dir)?;\nif a.capsule_id != m.package.name || a.version != m.package.version {\n    return Err(anyhow!(\"receipt approves {} {}, disk has {} {} — reinstall\", a.capsule_id, a.version, m.package.name, m.package.version));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never overwrite capsule directories manually; use the authorized install flow","Bump the version and reinstall when changing capsule contents","Keep capsule installs under tooling control, not ad-hoc file copies"],"tags":["capsule","integrity","version-mismatch","rust"],"backgroundTag":"checksum-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"}