sxyazi/yazi · error · io::Error

invalid trash entry path

Error message

invalid trash entry path

What it means

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

Solutions

  1. The .DS_Store entry path is invalid; the trash entry may be corrupt — restore the item manually from ~/.Trash.

When it happens

Trigger: Thrown at yazi-fs/src/trash/macos/ds_store.rs:38 when the library encounters an invalid state.

Common situations: Reading a macOS .DS_Store entry whose path bytes are malformed.


AI-assisted analysis of sxyazi/yazi@8ebf930f17 (2026-08-19). Data as JSON: /api/errors/7e1398838fd392f7. Report an issue: GitHub.

Appendix: source

Thrown at yazi-fs/src/trash/macos/ds_store.rs:38

			let Value::Ustr(value) = record.value else { continue };
			if value.is_empty() {
				continue;
			}

			let location = locations.entry_ref(OsStr::new(&record.name)).or_default();
			match &record.field.fourcc().bytes() {
				b"ptbL" => location.parent = Some(value.into()),
				b"ptbN" => location.name = Some(value.into()),
				_ => {}
			}
		}

		Ok(locations)
	}

	pub(super) fn join(&self, rel: &Path) -> io::Result<PathBuf> {
		if !rel.is_relative() || rel.has_parent_component() {
			return Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid trash entry path"));
		}

		let parent = self.parent.as_deref().ok_or_else(|| {
			io::Error::new(io::ErrorKind::InvalidData, "trash item has no put-back location")
		})?;

		let name = self.name.as_deref().ok_or_else(|| {
			io::Error::new(io::ErrorKind::InvalidData, "trash item has no put-back name")
		})?;

		let mut components = Path::new(name).components();
		if !matches!(components.next(), Some(Component::Normal(_))) || components.next().is_some() {
			return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid trash put-back name"));
		}

		let top_path = Path::new("/").join(parent).join(name);
		Ok(if rel.as_os_str().is_empty() { top_path } else { top_path.join(rel) })
	}

View on GitHub (pinned to 8ebf930f17)