sxyazi/yazi · error · io::Error

trash item has no put-back location

Error message

trash item has no put-back location

What it means

Fired in the macOS trash backend's restore() when a TrashEntry read from the ~/.Trash back-end has no original put-back URL recorded. This happens when the entry's trash metadata (bookmark/plist) is missing or corrupt — e.g. it was deleted, hand-edited, or never written when the item was trashed — so the item cannot be moved back to its original path. It surfaces as an io::Error with InvalidInput kind from the restore loop.

Solutions

  1. No put-back location is recorded for this item; restore it manually from ~/.Trash.
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: Restoring a macOS trash item for which no original location can be determined.


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

Appendix: source

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

		let changed = !latest.cha.hits(current.cha)
			|| latest.extra.link_to() != current.extra.link_to()
			|| latest.extra.backing() != current.extra.backing();

		Ok(changed.then_some(latest))
	}

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

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

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

			restore_item(&entry.backing, to)?;
		}
		Ok(())
	}

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

	pub(crate) fn empty(&self) -> io::Result<()> {
		let root = self.root()?;
		for dent in ok_or_not_found!(fs::read_dir(root), return Ok(())) {
			let dent = dent?;
			if dent.file_type()?.is_dir() {
				fs::remove_dir_all(dent.path())?;
			} else {

View on GitHub (pinned to 8ebf930f17)