sxyazi/yazi · error · io::Error

trash directory is not empty

Error message

trash directory is not empty

What it means

Error "trash directory is not empty" thrown in sxyazi/yazi.

Solutions

  1. The trash directory still contains items; empty it or resolve the conflicting entries before this operation.

When it happens

Trigger: Thrown at yazi-fs/src/trash/windows/trash.rs:91 when the library encounters an invalid state.

Common situations: Deleting a trash directory that still contains items, refusing a non-empty removal.


AI-assisted analysis of sxyazi/yazi@a541adde4e (2026-08-19). Data as JSON: /api/errors/72fb88aa277f074e. Report an issue: GitHub.

Appendix: source

Thrown at yazi-fs/src/trash/windows/trash.rs:92

		let cha = if let Some(entry) = entry {
			TrashSig::item(&self.resolve(entry)?)?
		} else {
			TrashSig::root()?
		};

		Ok(if cha.hits(current.cha) { None } else { Some(File { cha, ..current.clone() }) })
	}

	pub(crate) fn remove_file(&self, entry: &TrashEntry) -> io::Result<()> {
		self.resolve(entry)?.delete()
	}

	pub(crate) fn remove_dir(&self, entry: &TrashEntry) -> io::Result<()> {
		let item = self.resolve(entry)?;
		if !entry.has_rel() {
			item.delete()
		} else if !item.is_empty()? {
			Err(io::Error::new(io::ErrorKind::DirectoryNotEmpty, "trash directory is not empty"))
		} else {
			item.delete()
		}
	}

	pub(crate) fn restore(&self, entries: TrashEntries) -> io::Result<()> {
		for entry in entries {
			let to = entry.original.as_deref().ok_or_else(|| {
				io::Error::new(io::ErrorKind::NotFound, "trash item has no put-back location")
			})?;

			self.restore_do(&self.resolve(&entry)?, to)?;
		}
		Ok(())
	}

	pub(crate) fn rename(&self, entry: &TrashEntry, path: &Path) -> io::Result<()> {
		fs::rename(&entry.backing, path)

View on GitHub (pinned to a541adde4e)