sxyazi/yazi · error · io::Error

invalid trash entry

Error message

invalid trash entry

What it means

Error "invalid trash entry" thrown in sxyazi/yazi.

Solutions

  1. The trash entry id is malformed; use an id produced by a previous trash operation on this platform.

When it happens

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

Common situations: Parsing a trash entry identifier that does not match the expected trash ID format.


AI-assisted analysis of sxyazi/yazi@441b332de8 (2026-08-19). Data as JSON: /api/errors/2a8384ee9a554fc8. Report an issue: GitHub.

Appendix: source

Thrown at yazi-fs/src/trash/trash_id.rs:23

use yazi_shim::path::PathExt;

#[derive(Clone, Debug)]
pub(crate) struct TrashId {
	top: PathBuf,
	rel: PathBuf,
}

impl TrashId {
	pub(super) fn new<T, R>(top: T, rel: R) -> io::Result<Self>
	where
		T: Into<PathBuf>,
		R: Into<PathBuf>,
	{
		let top = top.into();
		let rel = rel.into();

		if top.as_os_str().is_empty() || !rel.is_relative() {
			return Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid trash entry"));
		}
		if rel.has_parent_component() {
			return Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid trash entry path"));
		}

		Ok(Self { top, rel })
	}

	pub(super) fn top(&self) -> &Path { &self.top }

	pub(super) fn rel(&self) -> &Path { &self.rel }

	#[cfg(target_os = "macos")]
	pub(super) fn path(&self) -> PathBuf {
		if self.has_rel() { self.top.join(&self.rel) } else { self.top.clone() }
	}

	pub(super) fn child(&self, name: &OsStr) -> io::Result<Self> {

View on GitHub (pinned to 441b332de8)