{"record":{"id":"1e76197d9a14abff","repo":"Hmbown/CodeWhale","slug":"not-one-regular-file","errorCode":null,"errorMessage":"not one regular file","messagePattern":"not one regular file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":13839,"sourceCode":"                    error.kind(),\n                    std::io::ErrorKind::WouldBlock | std::io::ErrorKind::Interrupted\n                ) =>\n            {\n                wait_for_event_lock(started, EVENT_TRANSACTION_LOCK_TIMEOUT)?;\n            }\n            Err(error) => {\n                return Err(error).context(\"Failed to lock Runtime store ownership\");\n            }\n        }\n    }\n}\n\n#[cfg(unix)]\nfn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {\n    use std::os::unix::fs::MetadataExt as _;\n\n    let metadata = file.metadata()?;\n    anyhow::ensure!(\n        metadata.is_file() && metadata.nlink() == 1,\n        \"not one regular file\"\n    );\n    Ok((metadata.dev(), metadata.ino()))\n}\n\n#[cfg(windows)]\nfn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {\n    use std::os::windows::fs::MetadataExt as _;\n    use std::os::windows::io::AsRawHandle as _;\n    use windows_sys::Win32::Storage::FileSystem::{\n        BY_HANDLE_FILE_INFORMATION, FILE_ATTRIBUTE_REPARSE_POINT, GetFileInformationByHandle,\n    };\n\n    let metadata = file.metadata()?;\n    let safe = metadata.is_file() && metadata.file_attributes() & FILE_ATTRIBUTE_REPARSE_POINT == 0;\n    anyhow::ensure!(safe, \"not a regular non-reparse file\");\n    let mut info = BY_HANDLE_FILE_INFORMATION::default();","sourceCodeStart":13821,"sourceCodeEnd":13857,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L13821-L13857","documentation":"On Unix, `runtime_store_file_identity` computes a (dev, ino) identity for a Runtime store file so two handles can be compared as the same underlying file. The ensure! rejects any file whose metadata is not a regular file or whose hard-link count is not exactly 1, because identity tracking only makes sense for a single unshared regular file. If a symlink target, directory, FIFO, device, or a hard-linked file is passed in, this error fires.","triggerScenarios":"Calling code passes a `File` handle whose underlying path is a directory, FIFO, socket, device node, or symlink-resolved special file (metadata.is_file() == false), or a file that has been hard-linked into a second location (metadata.nlink() > 1).","commonSituations":"Pointing the runtime store at a symlinked or bind-mounted path that resolves to something with nlink > 1; a tool created hard links between store snapshots; the store path was misconfigured to a directory or device.","solutions":["Check the store path resolves to a real regular file: `file <path>` and `stat -c '%h %F' <path>`; remove symlinks/hard links causing nlink > 1","Recreate the store as a plain regular file (copy its content to a new single-link file and update configuration)","Verify the code opening the store uses File::open on the regular file itself, not a directory or special file"],"exampleFix":"// before (fails: nlink > 1 from hard link)\nlet f = File::open(\"/store/runtime.bin\")?;\nlet id = runtime_store_file_identity(&f)?;\n// after (guaranteed single-link regular file)\nstd::fs::copy(\"/store/runtime.bin\", \"/store/runtime-unique.bin\")?;\nlet f = File::open(\"/store/runtime-unique.bin\")?;\nassert_eq!(f.metadata()?.nlink(), 1);\nlet id = runtime_store_file_identity(&f)?;","handlingStrategy":"validation","validationCode":"let m = f.metadata()?;\nif !(m.is_file() && m.nlink() == 1) {\n    return Err(anyhow!(\"store must be a single-link regular file\"));\n}","typeGuard":"fn is_storable_file(f: &File) -> bool {\n    f.metadata().map(|m| m.is_file() && m.nlink() == 1).unwrap_or(false)\n}","tryCatchPattern":"match runtime_store_file_identity(&f) {\n    Ok((dev, ino)) => use_identity(dev, ino),\n    Err(e) => log::error!(\"store file unusable: {e:#}\"),\n}","preventionTips":["Never point the store at symlinks or hard-linked paths","Check `stat` nlink and file type before configuring the store path","Avoid backup/dedup tools that hard-link the store directory"],"tags":["filesystem","unix","file-identity"],"backgroundTag":"incompatible-source-type","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}