{"record":{"id":"76e3b1181589073d","repo":"astrid-runtime/astrid","slug":"invaliddata-76e3b1","errorCode":"InvalidData","errorMessage":"unsupported Astrid home layout version {other:?}","messagePattern":"unsupported Astrid home layout version (.+?)","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/legacy_migration_barrier/mod.rs","lineNumber":98,"sourceCode":"\n/// Layout state captured before `AstridHome::ensure` can create a v2\n/// sentinel.  A bool cannot distinguish a brand-new home from a cut-over\n/// home that lost its completion ledger.\n#[derive(Clone, Copy, Debug, Eq, PartialEq)]\n#[cfg_attr(not(unix), allow(dead_code))]\npub(crate) enum LayoutOrigin {\n    Fresh,\n    Legacy,\n    ExistingV2,\n}\n\n#[cfg(any(unix, test))]\npub(crate) fn capture_layout_origin(home: &AstridHome) -> io::Result<LayoutOrigin> {\n    match home.layout_version()?.as_deref() {\n        None => Ok(LayoutOrigin::Fresh),\n        Some(astrid_core::dirs::LEGACY_LAYOUT_VERSION) => Ok(LayoutOrigin::Legacy),\n        Some(LAYOUT_VERSION) => Ok(LayoutOrigin::ExistingV2),\n        Some(other) => Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\"unsupported Astrid home layout version {other:?}\"),\n        )),\n    }\n}\n\n/// Path of the global migration ledger.\n#[must_use]\npub(crate) fn ledger_path(home: &AstridHome) -> PathBuf {\n    home.migrations_dir().join(LEDGER_NAME)\n}\n\n/// Reject an existing layout-two home that was cut over without the complete\n/// component ledger.  Fresh homes have no sentinel yet and are admitted by\n/// the caller, which creates the ledger after the durable store is open.\npub(crate) fn reject_incomplete_layout_v2(home: &AstridHome) -> io::Result<()> {\n    if home.layout_version()?.as_deref() != Some(LAYOUT_VERSION) {\n        return Ok(());","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/legacy_migration_barrier/mod.rs#L80-L116","documentation":"capture_layout_origin classifies an Astrid home by reading its layout-version sentinel file. The version string it found is not absent (fresh), not the legacy version, and not the current LAYOUT_VERSION (v2), so the home was written by an unknown/newer or corrupt version and the library refuses to guess, throwing InvalidData.","triggerScenarios":"Any call chain reaching capture_layout_origin (e.g. via origin_is_captured_before_fresh_home_ensure in run()) where home.layout_version() returns Some(v) with v not equal to astrid_core::dirs::LEGACY_LAYOUT_VERSION and not equal to LAYOUT_VERSION.","commonSituations":"Pointing the Astrid home at a directory created by a newer astrid release (downgrade scenario), a hand-edited or corrupted layout sentinel file, or a foreign tool writing an unexpected sentinel value into the home directory.","solutions":["Check the layout-version sentinel file in the Astrid home; note its value.","If it was written by a newer astrid version, upgrade astrid to match — downgrades across layout versions are unsupported.","If the sentinel is corrupt or hand-edited, restore it to the current LAYOUT_VERSION value or remove the home and let astrid initialize a fresh one after backing up data.","If this is a legacy home, ensure the sentinel matches astrid_core::dirs::LEGACY_LAYOUT_VERSION so the migration path is selected."],"exampleFix":"// before (sentinel written by newer release)\n$ cat ~/.astrid/layout-version\n\"v3\"\n\n// after: upgrade astrid, or remove the unknown sentinel/home\n$ astrid --version   # confirm release matches sentinel\n$ rm ~/.astrid/layout-version && astrid init  # fresh home after backup","handlingStrategy":"validation","validationCode":"let version = home.layout_version()?;\nmatch version.as_deref() {\n    None => { /* fresh: ok */ }\n    Some(v) if v == astrid_core::dirs::LEGACY_LAYOUT_VERSION => { /* migrate first */ }\n    Some(v) if v == astrid_kernel::legacy_migration_barrier::LAYOUT_VERSION => { /* v2 ok */ }\n    Some(other) => eprintln!(\"unsupported layout version {other:?}; upgrade astrid\"),\n}","typeGuard":"fn is_supported_layout(v: Option<&str>) -> bool {\n    matches!(v, None | Some(x) if x == astrid_core::dirs::LEGACY_LAYOUT_VERSION || x == \"2\")\n}","tryCatchPattern":null,"preventionTips":["Never downgrade astrid across layout versions against an existing home.","Do not hand-edit the layout sentinel file.","Back up the whole home directory, not selected files, before version changes.","Check `astrid --version` compatibility before pointing at a shared home."],"tags":["io","migration","versioning","invalid-data"],"backgroundTag":"invalid-config-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}