{"record":{"id":"232bb33febd3706e","repo":"sxyazi/yazi","slug":"unknown-image-format","errorCode":null,"errorMessage":"unknown image format","messagePattern":"unknown image format","errorType":"exception","errorClass":"ImageError","httpStatus":null,"severity":"error","filePath":"yazi-binding/src/image.rs","lineNumber":22,"sourceCode":"use mlua::{MetaMethod, UserData, UserDataFields, UserDataMethods};\n\n// --- ImageInfo\n#[derive(Clone, Copy)]\npub struct ImageInfo {\n\tpub format:      image::ImageFormat,\n\tpub width:       u32,\n\tpub height:      u32,\n\tpub color:       image::ColorType,\n\tpub orientation: Option<image::metadata::Orientation>,\n}\n\nimpl ImageInfo {\n\tpub async fn new(path: PathBuf) -> image::ImageResult<Self> {\n\t\ttokio::task::spawn_blocking(move || {\n\t\t\tlet reader = image::ImageReader::open(path)?.with_guessed_format()?;\n\n\t\t\tlet Some(format) = reader.format() else {\n\t\t\t\treturn Err(ImageError::IoError(std::io::Error::new(\n\t\t\t\t\tstd::io::ErrorKind::InvalidData,\n\t\t\t\t\t\"unknown image format\",\n\t\t\t\t)));\n\t\t\t};\n\n\t\t\tlet mut decoder = reader.into_decoder()?;\n\t\t\tlet (width, height) = decoder.dimensions();\n\t\t\tOk(Self {\n\t\t\t\tformat,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tcolor: decoder.color_type(),\n\t\t\t\torientation: decoder.orientation().ok(),\n\t\t\t})\n\t\t})\n\t\t.await\n\t\t.map_err(|e| ImageError::IoError(e.into()))?\n\t}","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/sxyazi/yazi/blob/94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2/yazi-binding/src/image.rs#L4-L40","documentation":"Error \"unknown image format\" thrown in sxyazi/yazi.","triggerScenarios":"Thrown at yazi-binding/src/image.rs:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94abcfa92f4ad3f0a1aef6c1ea083cfb8aa6c8c2","analyzedAt":"2026-08-16T09:56:24.836Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}