{"record":{"id":"aed029179cf97633","repo":"tailwindlabs/tailwindcss","slug":"stdin-has-no-metadata","errorCode":null,"errorMessage":"<stdin> has no metadata","messagePattern":"<stdin> has no metadata","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/ignore/src/walk.rs","lineNumber":184,"sourceCode":"        match *self {\n            Stdin => false,\n            Walkdir(ref x) => x.path_is_symlink(),\n            Raw(ref x) => x.path_is_symlink(),\n        }\n    }\n\n    fn is_stdin(&self) -> bool {\n        match *self {\n            DirEntryInner::Stdin => true,\n            _ => false,\n        }\n    }\n\n    fn metadata(&self) -> Result<Metadata, Error> {\n        use self::DirEntryInner::*;\n        match *self {\n            Stdin => {\n                let err = Error::Io(io::Error::new(\n                    io::ErrorKind::Other,\n                    \"<stdin> has no metadata\",\n                ));\n                Err(err.with_path(\"<stdin>\"))\n            }\n            Walkdir(ref x) => x\n                .metadata()\n                .map_err(|err| Error::Io(io::Error::from(err)).with_path(x.path())),\n            Raw(ref x) => x.metadata(),\n        }\n    }\n\n    fn file_type(&self) -> Option<FileType> {\n        use self::DirEntryInner::*;\n        match *self {\n            Stdin => None,\n            Walkdir(ref x) => Some(x.file_type()),\n            Raw(ref x) => Some(x.file_type()),","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/crates/ignore/src/walk.rs#L166-L202","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before — panics/errors on stdin\nlet md = entry.metadata()?;\n\n// after\nif entry.is_stdin() {\n    return Ok(()); // skip metadata for stdin\n}\nlet md = entry.metadata()?;","handlingStrategy":"type-guard","validationCode":"// Rust: skip metadata for stdin entries\nif entry.is_stdin() {\n    return Ok(default_metadata)\n}\nlet md = entry.metadata()?","typeGuard":"// Rust\nfn is_stdin_entry(entry: &DirEntry) -> bool {\n    entry.is_stdin()\n}","tryCatchPattern":"let md = match entry.metadata() {\n    Ok(m) => m,\n    Err(ref e) if e.to_string().contains(\"no metadata\") => continue,\n    Err(e) => return Err(e),\n};","preventionTips":["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."],"tags":["ignore","rust","walkdir","stdin","filesystem"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}