sxyazi/yazi · error · io::Error

invalid restore target

Error message

invalid restore target

What it means

Error "invalid restore target" thrown in sxyazi/yazi.

Source

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

		fs::rename(&entry.backing, path)
	}

	fn restore_do(&self, item: &ShellItem, to: &Path) -> io::Result<()> {
		match fs::symlink_metadata(to) {
			Ok(_) => {
				return Err(io::Error::new(
					io::ErrorKind::AlreadyExists,
					format!("restore target already exists: {to:?}"),
				));
			}
			Err(e) if e.kind() == io::ErrorKind::NotFound => {}
			Err(e) => return Err(e),
		}

		// Create parent directories
		let parent = to
			.parent()
			.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "invalid restore target"))?;
		fs::create_dir_all(parent)?;

		let parent = ShellItem::new(parent)?;
		let name: Vec<u16> = to
			.file_name()
			.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "invalid restore target"))?
			.encode_wide()
			.chain([0])
			.collect();

		operate(FOF_NO_UI | FOFX_EARLYFAILURE, |operation| unsafe {
			operation.MoveItem(&item.0, &parent.0, PCWSTR(name.as_ptr()), None)
		})
	}

	pub(crate) fn empty(&self) -> io::Result<()> {
		unsafe {
			SHEmptyRecycleBinW(

View on GitHub (pinned to 441b332de8)

Solutions

  1. The recorded restore target path is invalid; restore the item manually from the Recycle Bin.

When it happens

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

Common situations: Restoring to a target path that is invalid or fails validation on Windows.


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