sxyazi/yazi · error · ImageError

unknown image format

Error message

unknown image format

What it means

Error "unknown image format" thrown in sxyazi/yazi.

Source

Thrown at yazi-binding/src/image.rs:22

use mlua::{MetaMethod, UserData, UserDataFields, UserDataMethods};

// --- ImageInfo
#[derive(Clone, Copy)]
pub struct ImageInfo {
	pub format:      image::ImageFormat,
	pub width:       u32,
	pub height:      u32,
	pub color:       image::ColorType,
	pub orientation: Option<image::metadata::Orientation>,
}

impl ImageInfo {
	pub async fn new(path: PathBuf) -> image::ImageResult<Self> {
		tokio::task::spawn_blocking(move || {
			let reader = image::ImageReader::open(path)?.with_guessed_format()?;

			let Some(format) = reader.format() else {
				return Err(ImageError::IoError(std::io::Error::new(
					std::io::ErrorKind::InvalidData,
					"unknown image format",
				)));
			};

			let mut decoder = reader.into_decoder()?;
			let (width, height) = decoder.dimensions();
			Ok(Self {
				format,
				width,
				height,
				color: decoder.color_type(),
				orientation: decoder.orientation().ok(),
			})
		})
		.await
		.map_err(|e| ImageError::IoError(e.into()))?
	}

View on GitHub (pinned to 94abcfa92f)

When it happens

Trigger: Thrown at yazi-binding/src/image.rs:22 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/232bb33febd3706e. Report an issue: GitHub.