tailwindlabs/tailwindcss · error · io::Error

walkdir: same_file_system option not supported on this platf

Error message

walkdir: same_file_system option not supported on this platform

What it means

Returned by device_num() when compiled for a target that is neither unix nor windows. device_num provides the volume/device number used by the same_file_system option (to detect filesystem boundaries during traversal). On unsupported platforms the option cannot work, so it errors instead of silently disabling.

Source

Thrown at crates/ignore/src/walk.rs:2030

#[cfg(unix)]
fn device_num<P: AsRef<Path>>(path: P) -> io::Result<u64> {
    use std::os::unix::fs::MetadataExt;

    path.as_ref().metadata().map(|md| md.dev())
}

#[cfg(windows)]
fn device_num<P: AsRef<Path>>(path: P) -> io::Result<u64> {
    use winapi_util::{Handle, file};

    let h = Handle::from_path_any(path)?;
    file::information(h).map(|info| info.volume_serial_number())
}

#[cfg(not(any(unix, windows)))]
fn device_num<P: AsRef<Path>>(_: P) -> io::Result<u64> {
    Err(io::Error::new(
        io::ErrorKind::Other,
        "walkdir: same_file_system option not supported on this platform",
    ))
}

#[cfg(test)]
mod tests {
    use std::ffi::OsStr;
    use std::fs::{self, File};
    use std::io::Write;
    use std::path::Path;
    use std::sync::{Arc, Mutex};

    use super::{DirEntry, WalkBuilder, WalkState};
    use crate::tests::TempDir;

    fn wfile<P: AsRef<Path>>(path: P, contents: &str) {
        let mut file = File::create(path).unwrap();

View on GitHub (pinned to 16e94cbf7f)

Solutions

  1. Do not enable same_file_system(true) on non-unix/non-windows targets.
  2. Target wasm32-wasi or a real unix/windows platform if you need filesystem-boundary detection.
  3. Conditionally set the option: builder.same_file_system(cfg!(any(windows, unix))).

Example fix

// before — errors on wasm32
builder.same_file_system(true);

// after
builder.same_file_system(cfg!(any(windows, unix)));
Defensive patterns

Strategy: validation

Validate before calling

// Only enable same_file_system where device_num is real
builder.same_file_system(cfg!(any(windows, unix)));

Type guard

const fn supports_device_num() -> bool {
    cfg!(any(windows, unix))
}

Prevention

When it happens

Trigger: Enabling WalkBuilder::same_file_system(true) and building/running on a non-unix/non-windows target (e.g. wasm32). The fallback device_num always returns this error, so any traversal needing device numbers fails.

Common situations: WASM/embedded builds where a consumer enabled same_file_system. Porting desktop tooling that relies on same_file_system to a sandboxed runtime.

Related errors


AI-assisted analysis of tailwindlabs/tailwindcss@16e94cbf7f (2026-08-12). Data as JSON: /api/errors/84ee1b85078b35f1. Report an issue: GitHub.