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
- Check entry.is_stdin() (or match on the entry kind) before calling metadata().
- Treat stdin entries as a fixed file type (e.g. handle them separately from filesystem traversal).
- 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
- Special-case stdin entries before any filesystem query.
- Do not assume every DirEntry is backed by a real path.
- When accepting '-' as input, branch on it explicitly.
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
- unsupported platform
- walkdir: same_file_system option not supported on this platf
- Failed to read file
- The browser build does not support @import for "${id}"
- The `source(${compiler.root.pattern})` does not exist or is
AI-assisted analysis of tailwindlabs/tailwindcss@16e94cbf7f (2026-08-12).
Data as JSON: /api/errors/aed029179cf97633.
Report an issue: GitHub.