Hmbown/CodeWhale · error

not one regular file

Error message

not one regular file

What it means

Unix guard in runtime_store_file_identity: metadata showed the opened Runtime store/event file is either not a regular file or has nlink != 1. It fires when the path is a symlink, device, socket, directory, or a hard-linked file — conditions under which dev/ino identity checking is unsafe — and protects the store against TOCTOU swaps via links.

Source

Thrown at crates/tui/src/runtime_threads.rs:8958

    {
        use std::os::windows::fs::OpenOptionsExt as _;
        use windows_sys::Win32::Storage::FileSystem::FILE_FLAG_OPEN_REPARSE_POINT;
        options.custom_flags(FILE_FLAG_OPEN_REPARSE_POINT);
    }
    let file = options
        .open(path)
        .with_context(|| format!("Failed to open {purpose} {}", path.display()))?;
    runtime_store_file_identity(&file)
        .with_context(|| format!("Invalid {purpose} {}", path.display()))?;
    Ok(file)
}

#[cfg(unix)]
fn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {
    use std::os::unix::fs::MetadataExt as _;

    let metadata = file.metadata()?;
    anyhow::ensure!(
        metadata.is_file() && metadata.nlink() == 1,
        "not one regular file"
    );
    Ok((metadata.dev(), metadata.ino()))
}

#[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();

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Inspect the store/event path with ls -l and stat: remove any symlink or hard link pointing at it
  2. Restore the store file as a single regular inode (copy contents to a fresh file and replace)
  3. Ensure no backup tool or wrapper is hard-linking the runtime store
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/runtime_threads.rs:8958 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/1e76197d9a14abff. Report an issue: GitHub.