{"record":{"id":"740d28e2d18bc536","repo":"astrid-runtime/astrid","slug":"durable-layout-records-are-unsupported-on-this-ope","errorCode":null,"errorMessage":"durable layout records are unsupported on this operating system","messagePattern":"durable layout records are unsupported on this operating system","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/astrid-core/src/dirs_layout.rs","lineNumber":556,"sourceCode":"            },\n            Err(error) if error.kind() == io::ErrorKind::NotFound => {},\n            Err(error) => return Err(error),\n        }\n        let mut file = OpenOptions::new()\n            .write(true)\n            .create_new(true)\n            .mode(0o600)\n            .open(&staged)?;\n        file.write_all(bytes)?;\n        file.sync_all()?;\n        crate::platform_fs::rename_with_write_through(&staged, path)?;\n        File::open(parent)?.sync_all()\n    }\n\n    #[cfg(not(any(unix, windows)))]\n    {\n        let _ = (path, bytes);\n        Err(io::Error::new(\n            io::ErrorKind::Unsupported,\n            \"durable layout records are unsupported on this operating system\",\n        ))\n    }\n}\n\n/// Validate and retire a legacy directory tree without following redirects.\n///\n/// The complete tree is checked for symlinks, special entries, filesystem\n/// boundaries, and active mounts before bottom-up deletion. Directory fsyncs\n/// make successful removal durable on hosted Unix filesystems.\n///\n/// # Errors\n///\n/// Returns an I/O error and leaves the tree untouched when validation finds a\n/// redirect, special entry, filesystem boundary, or active mount.\npub fn retire_legacy_source_tree(path: &Path) -> io::Result<()> {\n    retire_legacy_source_tree_impl(path)","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-core/src/dirs_layout.rs#L538-L574","documentation":"atomic_write only implements durable atomic layout-record writes for unix and windows. On any other target family it returns ErrorKind::Unsupported with this message, because there is no portable way to create, rename, and fsync files there. It is a compile-time-target limitation, not a runtime data problem.","triggerScenarios":"Calling write_layout_version (or anything that admits/writes canonical layout records) when compiled for a target that is neither unix nor windows (e.g. wasm, os-less embedded).","commonSituations":"Cross-compiling the crate for wasm or an embedded target and invoking layout migration/record-writing code; CI running a non-unix/non-windows target triple.","solutions":["Run the layout-writing code on a supported unix or windows target.","cfg-gate the call in your code for supported target families and provide a native-host migration step for other targets.","If you need another platform, contribute a platform-specific atomic_write implementation (create temp + rename + fsync) rather than bypassing the guard."],"exampleFix":"// before (unsupported target)\nwrite_layout_version(&dir.join(\"layout.json\"), &record)?;\n// after\n#[cfg(any(unix, windows))]\nwrite_layout_version(&dir.join(\"layout.json\"), &record)?;","handlingStrategy":"fallback","validationCode":"fn durable_layout_supported() -> bool {\n    cfg!(any(unix, windows))\n}","typeGuard":"fn platform_supports_atomic_layout_writes() -> bool {\n    cfg!(unix) || cfg!(windows)\n}","tryCatchPattern":"match write_layout_version(path, record) {\n    Err(e) if e.kind() == io::ErrorKind::Unsupported => {\n        // run layout writes on a supported host instead\n    },\n    other => other?,\n}","preventionTips":["Restrict layout-mutating code to unix/windows targets via cfg gates","Cover all target triples in CI to surface unsupported paths early","Provide a native-host migration step for non-supported targets"],"tags":["filesystem","unsupported-platform","atomic-write"],"backgroundTag":"unsupported-platform","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}