{"record":{"id":"de7e91665ddd4c81","repo":"Hmbown/CodeWhale","slug":"must-be-a-regular-file","errorCode":null,"errorMessage":"must be a regular file","messagePattern":"must be a regular file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":8990,"sourceCode":"\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();\n    // SAFETY: the handle and writable output remain valid for the call.\n    if unsafe { GetFileInformationByHandle(file.as_raw_handle(), &mut info) } == 0 {\n        return Err(std::io::Error::last_os_error()).context(\"Inspect Runtime store file identity\");\n    }\n    anyhow::ensure!(info.nNumberOfLinks == 1, \"has multiple filesystem links\");\n    Ok((\n        u64::from(info.dwVolumeSerialNumber),\n        (u64::from(info.nFileIndexHigh) << 32) | u64::from(info.nFileIndexLow),\n    ))\n}\n\n#[cfg(all(not(unix), not(windows)))]\nfn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {\n    anyhow::ensure!(file.metadata()?.is_file(), \"must be a regular file\");\n    Ok((0, 0))\n}\n\nfn validate_same_runtime_store_file_handles(\n    first: &File,\n    second: &File,\n    path: &Path,\n) -> Result<()> {\n    let first = runtime_store_file_identity(first)?;\n    let second = runtime_store_file_identity(second)?;\n    anyhow::ensure!(\n        first == second,\n        \"Runtime event file changed: {}\",\n        path.display()\n    );\n    Ok(())\n}\n","sourceCodeStart":8972,"sourceCodeEnd":9008,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/runtime_threads.rs#L8972-L9008","documentation":"Fallback-platform guard in runtime_store_file_identity (cfg(all(not(unix), not(windows)))): on an OS with no dev/ino or file-index APIs, the only check available is that the handle refers to a regular file. It fires when the opened store/event path is a directory, special file, or similar; identity is then degenerate (0, 0).","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:8990 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the store path is a plain file, not a directory or device node","Point the runtime store at a regular file on a supported filesystem","On production platforms use the Unix/Windows builds, which do full identity checks"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}