astrid-runtime/astrid · error
capsule version mismatch for '{expected}': expected '{expect
Error message
capsule version mismatch for '{expected}': expected '{expected_version}', manifest declares '{}' What it means
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.
Source
Thrown at crates/astrid-capsule-install/src/local.rs:515
) -> anyhow::Result<InstallOutput> {
let inspection = inspect_directory_for_principal_in_workspace(
source_dir,
home,
target_principal,
options.workspace,
workspace_root,
workspace_layout,
)?;
if inspection.capsule_id != *expected {
bail!(
"capsule identity mismatch: expected '{expected}', manifest declares '{}'",
inspection.capsule_id
);
}
if let Some(expected_version) = expected_version
&& inspection.version != expected_version
{
bail!(
"capsule version mismatch for '{expected}': expected '{expected_version}', manifest declares '{}'",
inspection.version
);
}
let authority = authorize_install(&inspection, decision)?;
install_from_local_path_internal(
source_dir,
home,
options,
target_principal,
InstallWorkspace {
root: workspace_root,
layout: workspace_layout,
},
Some(ExpectedCapsuleIdentity {
id: expected,
version: expected_version,
}),View on GitHub (pinned to affd8760f4)
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
Example fix
// before
install_..._with_layout(&src, &id, Some(Version::parse("1.2.0")?), ...)?;
// after
let manifest: Manifest = toml::from_str(&std::fs::read_to_string(src.join("Capsule.toml"))?)?;
install_..._with_layout(&src, &id, Some(manifest.package.version.clone()), ...)?; Defensive patterns
Strategy: validation
Validate before calling
fn ensure_expected_version(src: &Path, expected: &Version) -> anyhow::Result<()> {
let manifest: Manifest = toml::from_str(&std::fs::read_to_string(src.join("Capsule.toml"))?)?;
anyhow::ensure!(manifest.package.version == *expected, "version drift: {} vs {expected}", manifest.package.version);
Ok(())
} Try / catch
if let Err(e) = install_..._checked_authorized(...) {
if e.to_string().contains("capsule version mismatch") {
// re-read manifest version and re-run authorization for that version
} else { return Err(e); }
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- capsule version mismatch for '{id}': expected '{expected_ver
- capsule identity or version changed after authority decision
- capsule identity mismatch: expected '{expected}', manifest d
- No Capsule.toml found in {}
- capsule identity mismatch: expected '{}', manifest declares
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/ab1bea3ed91f57d7.
Report an issue: GitHub.