{"record":{"id":"9bb2c440134235c6","repo":"unicity-aos/aos-ce","slug":"staged-runtime-did-not-validate-against-its-import-manifest","errorCode":null,"errorMessage":"staged runtime did not validate against its import manifest","messagePattern":"staged runtime did not validate against its import manifest","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/unicity-aos-bootstrap/src/migration.rs","lineNumber":298,"sourceCode":"                format!(\"failed to validate ephemeral state exclusion: {error}\"),\n            )\n        })?;\n        entries.sort_by(|left, right| left.path.cmp(&right.path));\n        let legacy_distros = legacy_distros(&staging).map_err(|error| {\n            io::Error::new(\n                error.kind(),\n                format!(\"failed to inspect imported distro locks: {error}\"),\n            )\n        })?;\n        let receipt = Receipt {\n            migration_version: MIGRATION_VERSION,\n            schema_version: RECEIPT_SCHEMA_VERSION,\n            source: source.clone(),\n            entries,\n            legacy_distros,\n        };\n        if !receipt_matches(&staging, &receipt).map_err(|error| {\n            io::Error::new(\n                error.kind(),\n                format!(\"failed to validate staged import receipt: {error}\"),\n            )\n        })? {\n            return invalid(\"staged runtime did not validate against its import manifest\");\n        }\n        let staged_receipt = write_staged_receipt(&receipt_path, &receipt)?;\n        let backup = replace_target(&target, &staging)?;\n        if let Err(error) = finalize_receipt(&staged_receipt, &receipt_path) {\n            remove_path(&receipt_path)?;\n            remove_path(&staged_receipt)?;\n            rollback_target(&target, &backup)?;\n            return Err(error);\n        }\n        remove_backup(&backup)?;\n        Ok(())\n    })();\n    if result.is_err() && staging.exists() {","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/crates/unicity-aos-bootstrap/src/migration.rs#L280-L316","documentation":"After staging the imported runtime, `migrate_runtime` builds a `Receipt` (with schema version, source path, entries, and legacy distros) and verifies the staged tree against it via `receipt_matches`. If verification returns false, the staged runtime does not match its own import manifest, so the library raises `InvalidData` with this message instead of installing unverifiable state.","triggerScenarios":"`receipt_matches(&staging, &receipt)` returns `Ok(false)` during `migrate_runtime` — i.e. the entry list/hashes recorded during copy no longer match the staged files, or entries were added/removed/modified after the receipt was built.","commonSituations":"Another process mutating the staging directory mid-migration; a copy that silently truncated/corrupted a file; staging directory reused from a previous failed run leaving stale files.","solutions":["Re-run the migration with a fresh staging directory so entries and receipt are rebuilt consistently.","Ensure nothing else has write access to the staging path (check for concurrent jobs, tmpwatch/cleanup daemons).","Verify disk health and free space — partial writes or corruption during copy are a common cause of manifest mismatch.","If the error persists, compare the staged tree against the receipt (the wrapped inner error from receipt_matches names the failing entry) to find the divergent file."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match migrate_runtime(&source, &target) {\n    Err(e) if e.to_string().contains(\"did not validate against its import manifest\") => {\n        clean_staging_dir();\n        migrate_runtime(&source, &target)\n    }\n    other => other,\n}","preventionTips":["Use a fresh, empty staging directory for every migration attempt.","Ensure no cleanup daemons or concurrent processes touch the staging path.","Check disk health and free space before long copies."],"tags":["migration","integrity","validation","rust"],"backgroundTag":"checksum-mismatch","analyzedSha":"f6f22024fb1e8d122f28a1b4a9f75aee448ae839","analyzedAt":"2026-09-13T03:04:44.565Z","contentChangedAt":"2026-09-13T03:04:44.565Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}