bevyengine/bevy · error · AssetWriterError::Io
not empty
Error message
not empty
What it means
Returned by the memory writer's remove_empty_directory when the directory exists but still contains assets, metadata, or subdirectories. Modeled on filesystem behavior where rmdir fails on non-empty directories, the caller must empty the directory first.
Source
Thrown at crates/bevy_asset/src/io/memory.rs:588
return Err(AssetWriterError::Io(Error::new(
ErrorKind::NotFound,
"no such dir",
)));
}
Ok(())
}
async fn remove_empty_directory<'a>(&'a self, path: &'a Path) -> Result<(), AssetWriterError> {
let Some(dir) = self.root.get_dir(path) else {
return Err(AssetWriterError::Io(Error::new(
ErrorKind::NotFound,
"no such dir",
)));
};
let dir = dir.0.read().unwrap();
if !dir.assets.is_empty() || !dir.metadata.is_empty() || !dir.dirs.is_empty() {
return Err(AssetWriterError::Io(Error::new(
ErrorKind::DirectoryNotEmpty,
"not empty",
)));
}
self.root.remove_dir(path);
Ok(())
}
async fn remove_assets_in_directory<'a>(
&'a self,
path: &'a Path,
) -> Result<(), AssetWriterError> {
let Some(dir) = self.root.get_dir(path) else {
return Err(AssetWriterError::Io(Error::new(
ErrorKind::NotFound,
"no such dir",
)));View on GitHub (pinned to 396ca72708)
Solutions
- Remove all contained assets, meta files, and subdirectories before calling remove_empty_directory
- Use the non-empty-tolerant remove_directory instead if recursive deletion is intended
- Check the directory's contents first if emptiness is not guaranteed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_asset/src/io/memory.rs:588 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/77665f668957ef03.
Report an issue: GitHub.