tailwindlabs/tailwindcss · error · io::Error

<stdin> has no metadata

Error message

<stdin> has no metadata

What it means

Returned (as an io::Error wrapped in ignore::Error) by DirEntry::metadata() when the entry represents standard input (DirEntryInner::Stdin). Stdin is not a real file and has no filesystem metadata, so requesting its Metadata is meaningless. This is a hard error, not a graceful no-op.

Source

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

        match *self {
            Stdin => false,
            Walkdir(ref x) => x.path_is_symlink(),
            Raw(ref x) => x.path_is_symlink(),
        }
    }

    fn is_stdin(&self) -> bool {
        match *self {
            DirEntryInner::Stdin => true,
            _ => false,
        }
    }

    fn metadata(&self) -> Result<Metadata, Error> {
        use self::DirEntryInner::*;
        match *self {
            Stdin => {
                let err = Error::Io(io::Error::new(
                    io::ErrorKind::Other,
                    "<stdin> has no metadata",
                ));
                Err(err.with_path("<stdin>"))
            }
            Walkdir(ref x) => x
                .metadata()
                .map_err(|err| Error::Io(io::Error::from(err)).with_path(x.path())),
            Raw(ref x) => x.metadata(),
        }
    }

    fn file_type(&self) -> Option<FileType> {
        use self::DirEntryInner::*;
        match *self {
            Stdin => None,
            Walkdir(ref x) => Some(x.file_type()),
            Raw(ref x) => Some(x.file_type()),

View on GitHub (pinned to 16e94cbf7f)

Solutions

  1. Check entry.is_stdin() (or match on the entry kind) before calling metadata().
  2. Treat stdin entries as a fixed file type (e.g. handle them separately from filesystem traversal).
  3. If you only need content, read from the entry's reader instead of querying metadata.

Example fix

// before — panics/errors on stdin
let md = entry.metadata()?;

// after
if entry.is_stdin() {
    return Ok(()); // skip metadata for stdin
}
let md = entry.metadata()?;
Defensive patterns

Strategy: type-guard

Validate before calling

// Rust: skip metadata for stdin entries
if entry.is_stdin() {
    return Ok(default_metadata)
}
let md = entry.metadata()?

Type guard

// Rust
fn is_stdin_entry(entry: &DirEntry) -> bool {
    entry.is_stdin()
}

Try / catch

let md = match entry.metadata() {
    Ok(m) => m,
    Err(ref e) if e.to_string().contains("no metadata") => continue,
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: Calling .metadata() on a DirEntry obtained from stdin (when WalkBuilder::stdin() / the stdin input path is used and the iterator yields a stdin-backed entry). Common in ripgrep-style tooling that accepts '-' as a file argument.

Common situations: Tool built on the ignore crate that pipes '-' (stdin) and then unconditionally calls metadata() on every entry. Forgetting to special-case stdin when filtering by file type or size. Porting logic that worked for real paths onto a stdin entry.

Related errors


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