Hmbown/CodeWhale · error
has multiple filesystem links
Error message
has multiple filesystem links
What it means
After confirming the file is a regular non-reparse file on Windows, `runtime_store_file_identity` calls GetFileInformationByHandle and requires nNumberOfLinks == 1 so the (volume, file-index) pair uniquely identifies a single file. If the file has more than one hard link, the same physical data exists under multiple names and the identity is ambiguous, so this error is raised.
Solutions
- Break the extra links: keep one path and delete the others, or copy the file (a real copy resets link count to 1) and use the new file
- Disable or reconfigure hard-link-based backup/dedup tools that touch the store directory
- Regenerate the store so it starts as a fresh single-link file
Example fix
// before: file is hard-linked by a backup tool, nlink = 2
let f = File::open("C:\\store\\runtime.bin")?;
let id = runtime_store_file_identity(&f)?;
// after: real copy resets link count to 1
std::fs::copy("C:\\store\\runtime.bin", "C:\\store\\runtime2.bin")?;
std::fs::remove_file("C:\\store\\runtime.bin")?;
std::fs::rename("C:\\store\\runtime2.bin", "C:\\store\\runtime.bin")?;
let f = File::open("C:\\store\\runtime.bin")?;
let id = runtime_store_file_identity(&f)?; Defensive patterns
Strategy: validation
Validate before calling
use windows_sys::Win32::Storage::FileSystem::GetFileInformationByHandle;
// pre-check link count before identity computation
let meta = f.metadata()?;
if !meta.is_file() { return Err(anyhow!("not a regular file")); } Try / catch
if let Err(e) = runtime_store_file_identity(&f) {
eprintln!("store is hard-linked; make a real copy: {e:#}");
} Prevention
- Copy (not hard-link) the store when duplicating
- Disable hard-link dedup/backup tools on the store dir
- After a real copy, nlink returns to 1
When it happens
Trigger: The opened store file has nNumberOfLinks > 1 because it was hard-linked elsewhere (e.g. by a backup tool using hard links, deduplication software, or a manual `mklink /H`).
Common situations: Windows hard-link-based backup/dedup tools (rsync-like, cherry-backup) linked store snapshots; user copied the store with a hard-link-preserving tool; version control or sync tools created links.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Automation lock must not be a reparse point
- Codewhale-owned credential file must be singly linked
- Codewhale-owned xAI OAuth path has the wrong filesystem type
- config lock was redirected while opening
- could not inspect workspace .env link count
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/505a9f394189ab57.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/runtime_threads.rs:13862
}
#[cfg(windows)]
fn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {
use std::os::windows::fs::MetadataExt as _;
use std::os::windows::io::AsRawHandle as _;
use windows_sys::Win32::Storage::FileSystem::{
BY_HANDLE_FILE_INFORMATION, FILE_ATTRIBUTE_REPARSE_POINT, GetFileInformationByHandle,
};
let metadata = file.metadata()?;
let safe = metadata.is_file() && metadata.file_attributes() & FILE_ATTRIBUTE_REPARSE_POINT == 0;
anyhow::ensure!(safe, "not a regular non-reparse file");
let mut info = BY_HANDLE_FILE_INFORMATION::default();
// SAFETY: the handle and writable output remain valid for the call.
if unsafe { GetFileInformationByHandle(file.as_raw_handle(), &mut info) } == 0 {
return Err(std::io::Error::last_os_error()).context("Inspect Runtime store file identity");
}
anyhow::ensure!(info.nNumberOfLinks == 1, "has multiple filesystem links");
Ok((
u64::from(info.dwVolumeSerialNumber),
(u64::from(info.nFileIndexHigh) << 32) | u64::from(info.nFileIndexLow),
))
}
#[cfg(all(not(unix), not(windows)))]
fn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {
anyhow::ensure!(file.metadata()?.is_file(), "must be a regular file");
Ok((0, 0))
}
fn validate_same_runtime_store_file_handles(
first: &File,
second: &File,
path: &Path,
) -> Result<()> {
let first = runtime_store_file_identity(first)?;View on GitHub (pinned to 73e0f67d83)