{"record":{"id":"4faa70ce1bda8666","repo":"bevyengine/bevy","slug":"invalid-image-mime-type-0","errorCode":null,"errorMessage":"invalid image mime type: {0}","messagePattern":"invalid image mime type: (.+?)","errorType":"exception","errorClass":"GltfError","httpStatus":null,"severity":"error","filePath":"crates/bevy_gltf/src/loader/mod.rs","lineNumber":108,"sourceCode":"        mode: Mode,\n    },\n    /// Invalid glTF file.\n    #[error(\"invalid glTF file: {0}\")]\n    Gltf(#[from] gltf::Error),\n    /// Binary blob is missing.\n    #[error(\"binary blob is missing\")]\n    MissingBlob,\n    /// Decoding the base64 mesh data failed.\n    #[error(\"failed to decode base64 mesh data\")]\n    Base64Decode(#[from] base64::DecodeError),\n    /// Unsupported buffer format.\n    #[error(\"unsupported buffer format\")]\n    BufferFormatUnsupported,\n    /// The buffer URI was unable to be resolved with respect to the asset path.\n    #[error(\"invalid buffer uri: {0}. asset path error={1}\")]\n    InvalidBufferUri(String, ParseAssetPathError),\n    /// Invalid image mime type.\n    #[error(\"invalid image mime type: {0}\")]\n    #[from(ignore)]\n    InvalidImageMimeType(String),\n    /// Error when loading a texture. Might be due to a disabled image file format feature.\n    #[error(\"You may need to add the feature for the file format: {0}\")]\n    ImageError(#[from] TextureError),\n    /// The image URI was unable to be resolved with respect to the asset path.\n    #[error(\"invalid image uri: {0}. asset path error={1}\")]\n    InvalidImageUri(String, ParseAssetPathError),\n    /// Failed to read bytes from an asset path.\n    #[error(\"failed to read bytes from an asset path: {0}\")]\n    ReadAssetBytesError(#[from] ReadAssetBytesError),\n    /// Failed to load asset from an asset path.\n    #[error(\"failed to load asset from an asset path: {0}\")]\n    AssetLoadError(#[from] AssetLoadError),\n    /// Missing sampler for an animation.\n    #[error(\"Missing sampler for animation {0}\")]\n    #[from(ignore)]\n    MissingAnimationSampler(usize),","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_gltf/src/loader/mod.rs#L90-L126","documentation":"Variant for an image whose declared MIME type is not a recognized image format. Note the #[from(ignore)] attribute: in this codebase GltfError::InvalidImageMimeType is declared (loader/mod.rs:110) but never constructed — the equivalent failure now occurs inside Image::from_buffer (crates/bevy_image/src/image.rs:2334 raises TextureError::InvalidImageMimeType) and reaches callers wrapped as GltfError::ImageError(TextureError) via mod.rs:112. Match ImageError and inspect its TextureError payload; that is where an unknown image MIME actually surfaces today.","triggerScenarios":"Historically: an embedded image (Source::View) or data-URI image whose mime_type string was not one of the known image formats. Currently: same input, but reported as ImageError(TextureError::InvalidImageMimeType(mime)) from the Image::from_buffer calls at mod.rs:1228/1250.","commonSituations":"Exporters writing vendor MIME types for textures; JSON edited to a wrong mime; extension/mime mismatch after renaming texture files.","solutions":["Re-encode textures to a format Bevy supports (png, jpeg, webp, ktx2/basis, hdr, ...) with a matching MIME.","Match the mime string in JSON to the actual encoded bytes.","When handling the error, match GltfError::ImageError and read the TextureError to see whether it is truly an invalid mime or a disabled cargo feature."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const KNOWN: [&str; 6] = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/vnd.khronos.ktx2\", \"image/ktx2\", \"image/vnd.khronos.astc\"];\nfn image_mimes_ok(json: &serde_json::Value) -> bool {\n    json[\"images\"].as_array().unwrap_or(&vec![]).iter()\n        .filter_map(|i| i[\"mimeType\"].as_str())\n        .all(|m| KNOWN.contains(&m))\n}","typeGuard":null,"tryCatchPattern":"match err {\n    // note: GltfError::InvalidImageMimeType is declared but unused;\n    // unknown mimes arrive via TextureError inside ImageError\n    GltfError::ImageError(TextureError::InvalidImageMimeType(mime)) => {\n        error!(\"unsupported image mime {mime}; re-encode texture\");\n    }\n    other => return Err(other.into()),\n}","preventionTips":["Re-encode textures to png/jpg/webp/ktx2 before import.","Keep mimeType fields consistent with actual bytes.","Validate images with gltf-validator."],"tags":["gltf","image","mime-type","bevy"],"backgroundTag":"unsupported-mime-type","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}