{"record":{"id":"bbec79ec69a25cf0","repo":"astrid-runtime/astrid","slug":"durable-capsule-package-is-malformed","errorCode":null,"errorMessage":"durable capsule package is malformed","messagePattern":"durable capsule package is malformed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/astrid-kernel/src/lib.rs","lineNumber":2562,"sourceCode":"                                            error = %error,\n                                            \"Skipping durable capsule with unsafe materialization target\"\n                                        );\n                                        continue;\n                                    },\n                                };\n                                let manifest = astrid_capsule_install\n                                    ::read_verified_durable_package_for_owner(\n                                        store, &owner, &id,\n                                    )\n                                    .ok()\n                                    .flatten()\n                                    .map(|package| package.manifest().clone());\n                                let materialized = match manifest {\n                                    Some(manifest) => self.ensure_published_materialization(\n                                        &target, principal, &manifest, &snapshot,\n                                    ),\n                                    None => {\n                                        Err(anyhow::anyhow!(\"durable capsule package is malformed\"))\n                                    },\n                                };\n                                if let Err(error) = materialized {\n                                    tracing::warn!(\n                                        %principal,\n                                        capsule = %id,\n                                        error = %error,\n                                        \"Skipping durable capsule that failed materialization\"\n                                    );\n                                    continue;\n                                }\n                                paths.push(target);\n                            }\n                        },\n                        Err(error) => {\n                            tracing::warn!(\n                                %principal,\n                                error = %error,","sourceCodeStart":2544,"sourceCodeEnd":2580,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/lib.rs#L2544-L2580","documentation":"Thrown during durable-state recovery/materialization when a durable capsule snapshot has no package manifest (`manifest` is `None`) even though a package was expected (lib.rs:2562). The kernel cannot materialize a published capsule from a snapshot lacking a manifest, so it treats the durable package as malformed, logs a warning, and skips materialization rather than crashing the recovery pass.","triggerScenarios":"Recovery/reload loop iterating durable capsule snapshots where the stored package exists but its manifest cannot be produced (lib.rs:2562) — a truncated or partially written durable package, or a snapshot written by an incompatible writer.","commonSituations":"Crash or power loss mid-write leaving a torn package file in the durable store; upgrading the kernel across a manifest format change so old packages no longer parse into a manifest; disk corruption in the capsule storage directory.","solutions":["Delete the malformed durable package/snapshot and reinstall or republish the capsule so a fresh manifest is written","Inspect the durable storage directory for truncated/partial package files and remove them","Check kernel version compatibility: re-publish capsules persisted by an older manifest format"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Before recovery, sanity-check durable packages\nfor pkg in durable_packages {\n    if pkg.manifest().is_none() {\n        quarantine(pkg); // skip malformed snapshot before materialization\n    }\n}","typeGuard":null,"tryCatchPattern":"match materialization_result {\n    Err(e) if e.to_string().contains(\"durable capsule package is malformed\") => {\n        tracing::warn!(\"skipping malformed durable package; republish required\");\n        // mark for republish and continue recovery\n    },\n    other => other?,\n}","preventionTips":["Ensure durable package writes are atomic (write-temp-then-rename) to avoid torn files","Pin kernel versions across a cluster so manifest formats stay compatible","Periodically validate durable storage and republish capsules with missing manifests"],"tags":["rust","capsule","persistence","recovery"],"backgroundTag":"schema-validation-failed","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"}