sxyazi/yazi · error · io::Error

path too long

Error message

path too long

What it means

Error "path too long" thrown in sxyazi/yazi.

Source

Thrown at yazi-fs/src/engine/local/casefold.rs:234

		match unsafe { FindFirstFileW(wide.as_ptr(), &mut data) } {
			INVALID_HANDLE_VALUE => return Err(io::Error::last_os_error()),
			handle => _ = unsafe { FindClose(handle) },
		}

		let name = data.cFileName.split(|&c| c == 0).next().unwrap_or(&data.cFileName);
		Ok(parent.join(OsString::from_wide(name)))
	}

	let file = std::fs::OpenOptions::new()
		.access_mode(0)
		.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT)
		.open(path)?;

	match by_handle(&file, &mut [0u16; 512]) {
		Ok(Either::Left(path)) => Ok(path),
		Ok(Either::Right(len)) => match by_handle(&file, &mut vec![0u16; len as usize])? {
			Either::Left(path) => Ok(path),
			Either::Right(_) => Err(io::Error::new(io::ErrorKind::InvalidData, "path too long")),
		},
		// Fallback for paths that GetFinalPathNameByHandleW cannot handle,
		// such as those on DefineDosDeviceW-created devices (error 1005).
		Err(_) => by_find(path),
	}
}

#[cfg(any(
	target_os = "linux",
	target_os = "android",
	target_os = "netbsd",
	target_os = "openbsd"
))]
fn try_from_fd(fd: std::os::fd::RawFd, needle: &Path) -> Option<PathBuf> {
	use std::{ffi::OsString, os::unix::ffi::{OsStrExt, OsStringExt}};

	#[cfg(any(target_os = "linux", target_os = "android"))]
	let cand = format!("/proc/self/fd/{fd}");

View on GitHub (pinned to 94abcfa92f)

When it happens

Trigger: Thrown at yazi-fs/src/engine/local/casefold.rs:234 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sxyazi/yazi@94abcfa92f (2026-08-16). Data as JSON: /api/errors/154b59713a449f78. Report an issue: GitHub.