BurntSushi/ripgrep · error
unsupported platform
Error message
unsupported platform
What it means
DirEntryRaw::from_entry_os is gated #[cfg(not(any(windows, unix)))] and unconditionally returns Err('unsupported platform'). It is a stub so the ignore crate compiles on tier-3 targets, but building a directory entry from an fs::DirEntry is not implemented there, so it always fails at runtime.
Source
Thrown at crates/ignore/src/walk.rs:382
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_depth(depth).with_path(&pb))?;
Ok(DirEntryRaw {
path: pb,
ty: md.file_type(),
follow_link: link,
depth,View on GitHub (pinned to 3fce3b5bb0)
Solutions
- Target a supported platform (windows or unix) for filesystem walking.
- On the unsupported platform, supply entries manually via WalkBuilder::add / build_parallel with pre-built paths instead of relying on from_entry_os.
- Avoid invoking directory-walk features on unsupported targets; search explicit file lists only.
Defensive patterns
Strategy: validation
Validate before calling
const WALK_SUPPORTED: bool = cfg!(any(windows, unix));
Try / catch
if !cfg!(any(windows, unix)) {
eprintln!("directory walk unsupported on this platform");
return;
} Prevention
- Do not enable real directory walks on non-windows/non-unix targets.
- Feature-gate walk features behind cfg(any(windows, unix)).
- On unsupported targets, search explicit file lists only.
When it happens
Trigger: Running a directory walk (WalkBuilder) that yields entries via from_entry_os on a target that is neither windows nor unix (e.g. wasm32), causing every encountered fs::DirEntry to error.
Common situations: Cross-compiling a ripgrep-based tool to wasm/wasi and attempting a real filesystem walk; running grep ignore logic on an unsupported embedded target.
Related errors
- walkdir: same_file_system option not supported on this platf
- hostname could not be found on unsupported platform
- <stdin> has no metadata
AI-assisted analysis of BurntSushi/ripgrep@3fce3b5bb0 (2026-08-06).
Data as JSON: /data/errors/d02c9cbc89b3c829.json.
Report an issue: GitHub.