zed-industries/zed · error
failed to read directory entry in {path:?}
Error message
failed to read directory entry in {path:?} What it means
Raised in read_dir_entries when iterating the opened directory (Dir::new/handle on the already-open fd) fails while yielding entries, e.g. the directory was removed or an I/O error occurred mid-listing. The directory path is included for diagnosis.
Source
Thrown at crates/fs/src/fs.rs:710
fn read_dir_entries(path: PathBuf) -> Result<impl Send + Iterator<Item = Result<PathBuf>>> {
use rustix::fs::{Dir, Mode, OFlags};
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
let directory_fd = rustix::fs::open(
&path,
OFlags::RDONLY | OFlags::DIRECTORY | OFlags::CLOEXEC,
Mode::empty(),
)
.with_context(|| format!("failed to open directory {path:?}"))?;
let directory =
Dir::new(directory_fd).with_context(|| format!("failed to read directory {path:?}"))?;
Ok(directory.filter_map(move |entry| {
let entry = match entry {
Ok(entry) => entry,
Err(error) => {
return Some(Err(anyhow::Error::new(error)
.context(format!("failed to read directory entry in {path:?}"))));
}
};
let name = entry.file_name().to_bytes();
if name == b"." || name == b".." {
return None;
}
Some(Ok(path.join(OsStr::from_bytes(name))))
}))
}
#[cfg(not(unix))]
fn read_dir_entries(path: PathBuf) -> Result<impl Send + Iterator<Item = Result<PathBuf>>> {
let entries =
std::fs::read_dir(&path).with_context(|| format!("failed to open directory {path:?}"))?;
Ok(entries.map(move |entry| {
entry
.map(|entry| entry.path())View on GitHub (pinned to 9d272b0363)
Solutions
- Propagate the per-entry error to the consumer rather than silently skipping it
- Retry the directory scan; transient errors can occur when entries change during iteration
- Check filesystem health if the same directory consistently fails
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/fs/src/fs.rs:665 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/08fbbb98ca08cafe.
Report an issue: GitHub.