{"record":{"id":"34147b639706ed9c","repo":"unicity-aos/aos-ce","slug":"aos-capsule-set-differs-from-community-edition-expected","errorCode":null,"errorMessage":"AOS capsule set differs from Community Edition; expected {}, found {}","messagePattern":"AOS capsule set differs from Community Edition; expected (.+?), found (.+?)","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/unicity-aos-bootstrap/src/lib.rs","lineNumber":759,"sourceCode":"                format!(\n                    \"AOS capsule directory contains a non-regular entry: {}\",\n                    entry.path().display()\n                ),\n            ));\n        }\n        let name = entry.file_name().into_string().map_err(|_| {\n            io::Error::new(\n                io::ErrorKind::InvalidInput,\n                \"AOS capsule directory contains a non-UTF-8 entry\",\n            )\n        })?;\n        actual.push(name);\n    }\n    actual.sort();\n    let mut expected = expected.to_vec();\n    expected.sort();\n    if actual != expected {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\n                \"AOS capsule set differs from Community Edition; expected {}, found {}\",\n                expected.len(),\n                actual.len()\n            ),\n        ));\n    }\n    Ok(canonical)\n}\n\nfn materialize_manifest(capsule_dir: &Path) -> io::Result<String> {\n    let mut manifest = UNICITY_CE_MANIFEST\n        .parse::<toml::Value>()\n        .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;\n    let capsules = manifest\n        .get_mut(\"capsule\")\n        .and_then(toml::Value::as_array_mut)","sourceCodeStart":741,"sourceCodeEnd":777,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/crates/unicity-aos-bootstrap/src/lib.rs#L741-L777","documentation":"Thrown by validate_capsule_dir when the sorted set of filenames in the capsule directory does not equal the expected set derived from the embedded Community Edition manifest. Note the message prints only the expected and found counts; the library enforces an exact match to guarantee the on-disk capsule set mirrors the embedded distro.","triggerScenarios":"Extra stale .capsule files left in the directory, missing files that the embedded manifest requires, renamed files, or an embedded-manifest version differing from the installed capsule set — any capsule_dir_with / prepare_unicity_ce_init call then fails.","commonSituations":"Upgrading the application (new embedded manifest) while keeping an old capsule directory; manually deleting or adding capsule files; a partially completed install leaving a partial set.","solutions":["Delete the capsule directory and regenerate it with install_capsule_fixtures so it matches the embedded manifest","Compare directory contents against the embedded manifest's `[capsule]` source filenames and reconcile (add missing, remove extra)","If upgrading, clear the stale capsule directory before running prepare_unicity_ce_init"],"exampleFix":"// before\n$ ls ~/.aos/capsules\nauth.capsule  kernel-core.capsule  stale-old.capsule\n// after\n$ rm -rf ~/.aos/capsules && rerun install_capsule_fixtures\n$ ls ~/.aos/capsules\nauth.capsule  kernel-core.capsule","handlingStrategy":"validation","validationCode":"fn capsule_set_matches(dir: &std::path::Path, expected: &[String]) -> bool {\n    let mut actual: Vec<String> = std::fs::read_dir(dir)\n        .map(|rd| rd.filter_map(|e| e.ok())\n            .filter_map(|e| e.file_name().into_string().ok())\n            .collect())\n        .unwrap_or_default();\n    actual.sort();\n    let mut exp = expected.to_vec();\n    exp.sort();\n    actual == exp\n}","typeGuard":null,"tryCatchPattern":"match bootstrap::capsule_dir_with(&home) {\n    Err(e) if e.to_string().contains(\"capsule set differs\") => {\n        eprintln!(\"Capsule directory is stale or modified; regenerate it: {e}\");\n        // fs::remove_dir_all(capsules)?; install_capsule_fixtures(...)?;\n    }\n    Err(e) => return Err(e),\n    Ok(dir) => dir,\n}","preventionTips":["After upgrading the application, delete and regenerate the capsule directory","Never manually add or remove files in the capsule directory","Run install_capsule_fixtures idempotently to reconcile the set"],"tags":["rust","filesystem","integrity","capsules","versioning"],"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"}