tailwindlabs/tailwindcss · error · io::Error

unsupported platform

Error message

unsupported platform

What it means

Returned by DirEntryRaw::from_entry_os() when compiled for a target that is neither windows nor unix (guarded by #[cfg(not(any(windows, unix)))]). It is a placeholder so the crate compiles on e.g. wasm32, but directory-entry construction from a fs::DirEntry always fails there. This is an intentional 'unsupported on this platform' stub.

Source

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

        Ok(DirEntryRaw {
            path: ent.path(),
            ty,
            follow_link: false,
            depth,
            ino: ent.ino(),
        })
    }

    // Placeholder implementation to allow compiling on non-standard platforms
    // (e.g. wasm32).
    #[cfg(not(any(windows, unix)))]
    fn from_entry_os(
        depth: usize,
        ent: &fs::DirEntry,
        ty: fs::FileType,
    ) -> Result<DirEntryRaw, Error> {
        Err(Error::Io(io::Error::new(
            io::ErrorKind::Other,
            "unsupported platform",
        )))
    }

    #[cfg(windows)]
    fn from_path(depth: usize, pb: PathBuf, link: bool) -> Result<DirEntryRaw, Error> {
        let md = fs::metadata(&pb).map_err(|err| Error::Io(err).with_path(&pb))?;
        Ok(DirEntryRaw {
            path: pb,
            ty: md.file_type(),
            follow_link: link,
            depth,
            metadata: md,
        })
    }

    #[cfg(unix)]

View on GitHub (pinned to 16e94cbf7f)

Solutions

  1. Target a platform with real filesystem support (unix or windows) if you need directory walking.
  2. On wasm, use the wasm32-wasi target (which provides unix-like syscalls) instead of wasm32-unknown-unknown.
  3. Avoid calling directory-walk entry construction on platforms gated out by cfg.

Example fix

// before — builds on wasm32-unknown-unknown, errors at runtime
let entry = DirEntryRaw::from_entry_os(depth, &dir_entry, ft)?;

// after — target wasm32-wasi or a unix/windows target
// cargo build --target wasm32-wasi
Defensive patterns

Strategy: validation

Validate before calling

// Build-time guard
#[cfg(not(any(windows, unix)))]
compile_error!("directory walking is unsupported on this target");

Try / catch

let entry = DirEntryRaw::from_entry_os(depth, &de, ft)
    .map_err(|_| std::io::Error::new(std::io::ErrorKind::Unsupported, "dir walk unavailable"))?;

Prevention

When it happens

Trigger: Building and running the ignore crate on wasm32-unknown-unknown (or any non-windows/non-unix target) and attempting to walk a real directory via from_entry_os. The function exists only to satisfy type checking; it always errors.

Common situations: Compiling a tool that depends on ignore into a WASM module and then calling directory-walk APIs. Targeting an embedded/no_std-adjacent platform without unix/windows features.

Related errors


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