sxyazi/yazi · error · io::Error

trash info has no Path

Error message

trash info has no Path

What it means

Error "trash info has no Path" thrown in sxyazi/yazi.

Solutions

  1. The .trashinfo file has no Path= line; restore the item manually or delete the corrupt info file.

When it happens

Trigger: Thrown at yazi-fs/src/trash/freedesktop/trash_info.rs:55 when the library encounters an invalid state.

Common situations: Parsing a .trashinfo file that has no `Path=` line.


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

Appendix: source

Thrown at yazi-fs/src/trash/freedesktop/trash_info.rs:53

			return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid original trash path"));
		}

		Ok(Self { root: root.to_owned(), backing: root.join("files").join(stem), original })
	}

	fn parse_original(info: &Path, root: &Path) -> io::Result<PathBuf> {
		let mut reader = BufReader::new(File::open(info)?);
		let mut line = Vec::new();

		reader.read_until(b'\n', &mut line)?;
		Self::trim_line(&mut line);
		if line != b"[Trash Info]" {
			return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid trash info header"));
		}

		loop {
			line.clear();
			if reader.read_until(b'\n', &mut line)? == 0 {
				return Err(io::Error::new(io::ErrorKind::InvalidData, "trash info has no Path"));
			}

			Self::trim_line(&mut line);
			let Some(value) = line.strip_prefix(b"Path=") else { continue };
			let decoded: Cow<[u8]> = percent_decode(value).into();

			let path = Path::new(OsStr::from_bytes(decoded.as_ref()));
			if path.as_os_str().is_empty() || !path.is_absolute() && path.has_parent_component() {
				return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid original trash path"));
			}

			return Ok(if path.is_absolute() {
				path.to_owned()
			} else {
				Self::mount_point(root)?.join(path)
			});
		}

View on GitHub (pinned to a541adde4e)