sxyazi/yazi · error · anyhow::Error

Invalid WTF-8 sequence

Error message

Invalid WTF-8 sequence

What it means

Error "Invalid WTF-8 sequence" thrown in sxyazi/yazi.

Source

Thrown at yazi-shim/src/wtf8/wtf8.rs:41

// --- FromWtf8
pub trait FromWtf8 {
	fn from_wtf8(wtf8: &[u8]) -> Result<&Self>;
}

impl FromWtf8 for OsStr {
	fn from_wtf8(wtf8: &[u8]) -> Result<&Self> {
		#[cfg(unix)]
		{
			use std::os::unix::ffi::OsStrExt;
			Ok(Self::from_bytes(wtf8))
		}
		#[cfg(windows)]
		{
			if super::valid_wtf8(wtf8) {
				Ok(unsafe { Self::from_encoded_bytes_unchecked(wtf8) })
			} else {
				Err(anyhow::anyhow!("Invalid WTF-8 sequence"))
			}
		}
	}
}

impl FromWtf8 for std::path::Path {
	fn from_wtf8(wtf8: &[u8]) -> Result<&Self> { Ok(OsStr::from_wtf8(wtf8)?.as_ref()) }
}

// --- FromWtf8Vec
pub trait FromWtf8Vec {
	fn from_wtf8_vec(wtf8: Vec<u8>) -> Result<Self>
	where
		Self: Sized;
}

impl FromWtf8Vec for OsString {
	fn from_wtf8_vec(wtf8: Vec<u8>) -> Result<Self> {

View on GitHub (pinned to 94abcfa92f)

When it happens

Trigger: Thrown at yazi-shim/src/wtf8/wtf8.rs:41 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/a88237de58e3076d. Report an issue: GitHub.