{"record":{"id":"636493008510432d","repo":"astrid-runtime/astrid","slug":"stable-private-directory-identity-is-unavailable","errorCode":null,"errorMessage":"stable private directory identity is unavailable","messagePattern":"stable private directory identity is unavailable","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/astrid-storage/src/engine/durable/native_io.rs","lineNumber":151,"sourceCode":"    use windows_sys::Win32::Storage::FileSystem::{\n        BY_HANDLE_FILE_INFORMATION, GetFileInformationByHandle,\n    };\n\n    let mut info = BY_HANDLE_FILE_INFORMATION::default();\n    // SAFETY: `file` owns a live Windows handle and `info` is writable.\n    #[allow(unsafe_code)]\n    if unsafe { GetFileInformationByHandle(file.as_raw_handle().cast(), &raw mut info) } == 0 {\n        return Err(io::Error::last_os_error());\n    }\n    Ok((\n        u64::from(info.dwVolumeSerialNumber),\n        (u64::from(info.nFileIndexHigh) << 32) | u64::from(info.nFileIndexLow),\n    ))\n}\n\n#[cfg(not(any(unix, windows)))]\nfn file_identity(_file: &NativeFile) -> io::Result<(u64, u64)> {\n    Err(io::Error::new(\n        io::ErrorKind::Unsupported,\n        \"stable private directory identity is unavailable\",\n    ))\n}\n\nfn configure_no_follow(options: &mut OpenOptions) {\n    #[cfg(unix)]\n    {\n        use cap_std::fs::OpenOptionsExt as _;\n        options.custom_flags(libc::O_NOFOLLOW | libc::O_NONBLOCK);\n    }\n    #[cfg(windows)]\n    {\n        use cap_std::fs::OpenOptionsExt as _;\n        use windows_sys::Win32::Storage::FileSystem::FILE_FLAG_OPEN_REPARSE_POINT;\n        options.custom_flags(FILE_FLAG_OPEN_REPARSE_POINT);\n    }\n}","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage/src/engine/durable/native_io.rs#L133-L169","documentation":"file_identity retrieves a stable (device, file-index) identity for an open directory. On platforms that are neither Unix nor Windows, no stable identity API exists, so the function unconditionally returns ErrorKind::Unsupported. This is a platform-capability limitation, not a data problem.","triggerScenarios":"Calling open_directory (which compares directory identities) on a target platform outside cfg(unix) and cfg(windows) — e.g. wasm32 or a custom OS target — where native_io.rs compiles the fallback stub.","commonSituations":"Cross-compiling the storage engine for wasm/embedded targets; running the durable store inside a non-standard sandbox that exposes neither Unix nor Windows file semantics.","solutions":["Run the principal-store on a supported platform (Linux, macOS, other Unix, or Windows)","Enable the cfg(unix)/cfg(windows) code path by building for a supported target triple","Provide a platform-specific file_identity implementation for your target and contribute/gate it in native_io.rs","Avoid the durable engine on unsupported platforms; use an in-memory or alternative storage backend"],"exampleFix":"// before\n#[cfg(not(any(unix, windows)))]\nfn file_identity(_file: &NativeFile) -> io::Result<(u64, u64)> { Err(...) }\n// after\n#[cfg(target_os = \"myos\")]\nfn file_identity(file: &NativeFile) -> io::Result<(u64, u64)> {\n    myos::stat_index(file.as_raw_fd())\n}","handlingStrategy":"fallback","validationCode":"#[cfg(not(any(unix, windows)))]\ncompile_error!(\"principal-store durable engine requires unix or windows\");","typeGuard":"const FILE_IDENTITY_SUPPORTED: bool = cfg!(any(unix, windows));","tryCatchPattern":"match open_store(path) {\n    Err(e) if e.kind() == io::ErrorKind::Unsupported => switch_to_memory_backend(),\n    r => r,\n}","preventionTips":["Gate durable-storage usage behind cfg(any(unix, windows)) in your build","Test cross-compilation targets in CI before deploying them","Choose a non-durable backend explicitly for unsupported platforms"],"tags":["platform","unsupported","io"],"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"}