{"record":{"id":"4e84fb0c51c168f7","repo":"astrid-runtime/astrid","slug":"materialized-capsule-snapshot-differs-from-the-cal","errorCode":null,"errorMessage":"materialized capsule snapshot differs from the caller's publication","messagePattern":"materialized capsule snapshot differs from the caller's publication","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/capsule_materialization.rs","lineNumber":31,"sourceCode":"        principal: &astrid_core::principal::PrincipalId,\n        manifest: &astrid_capsule_types::manifest::CapsuleManifest,\n        snapshot: &astrid_storage::CapsulePackageSnapshot,\n    ) -> anyhow::Result<()> {\n        self.validate_published_cache_path(dir, principal, manifest, snapshot)?;\n        let uid = self\n            .principal_directory\n            .uid_for(principal)\n            .map_err(|error| anyhow::anyhow!(\"resolve capsule cache owner UID: {error}\"))?;\n        let verified = astrid_capsule_install::read_verified_durable_package_for_owner(\n            self.principal_store\n                .as_ref()\n                .ok_or_else(|| anyhow::anyhow!(\"durable capsule registry is unavailable\"))?,\n            &astrid_storage::StateOwner::Principal(uid),\n            manifest.package.name.as_str(),\n        )?\n        .ok_or_else(|| anyhow::anyhow!(\"materialized capsule is absent from durable registry\"))?;\n        if verified.snapshot() != snapshot {\n            anyhow::bail!(\"materialized capsule snapshot differs from the caller's publication\");\n        }\n        if verified.manifest().package.name != manifest.package.name\n            || verified.manifest().package.version != manifest.package.version\n        {\n            anyhow::bail!(\"materialized capsule manifest differs from durable registry\");\n        }\n        let manifest_bytes = Self::read_projection_file_nofollow(&dir.join(\"Capsule.toml\"))\n            .map_err(|error| anyhow::anyhow!(\"read materialized capsule manifest: {error:#}\"))?;\n        if manifest_bytes != verified.manifest_bytes() {\n            anyhow::bail!(\"durable capsule manifest bytes do not match materialization\");\n        }\n        let metadata_bytes = Self::read_projection_file_nofollow(&dir.join(\"meta.json\"))\n            .map_err(|error| anyhow::anyhow!(\"read materialized capsule metadata: {error:#}\"))?;\n        if metadata_bytes != verified.metadata_bytes() {\n            anyhow::bail!(\"durable capsule metadata does not match materialization\");\n        }\n        let authority_bytes = Self::read_projection_file_nofollow(&dir.join(\"authority.json\"))\n            .map_err(|error| anyhow::anyhow!(\"read materialized capsule authority: {error:#}\"))?;","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/capsule_materialization.rs#L13-L49","documentation":"Integrity check in verify_published_materialization: the CapsulePackageSnapshot read back from the materialized cache directory differs from the snapshot the caller published, meaning the on-disk projection was mutated, partially written, or belongs to a different publication.","triggerScenarios":"Thrown at crates/astrid-kernel/src/capsule_materialization.rs:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-materialize the capsule from the durable package to repair the cache directory","Check for concurrent writers or torn writes in the cache path","Verify the caller passed the snapshot that was actually published"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}