bevyengine/bevy · error · SaveImageError
could not determine asset format for extension "{0}"
Error message
could not determine asset format for extension "{0}" What it means
SaveImageError variant raised when the target path's file extension does not map to any known ImageFormat. The unrecognized extension is held in the payload. Choose a supported extension or specify SaveImageFormatSetting::Format.
Source
Thrown at crates/bevy_image/src/saver.rs:134
/// The setting for how to choose which file-format to use.
#[derive(Serialize, Deserialize, Default, Clone, Copy, Debug)]
pub enum SaveImageFormatSetting {
/// The file format to write will be deduced from the file path being written to.
#[default]
FromExtension,
/// This is the explicit file format being written.
Format(ImageFormat),
}
/// An error while saving an image.
#[derive(Error, Debug)]
pub enum SaveImageError {
/// Cannot deduce file format from extension because there is no extension.
#[error("SaveImageFormatSetting::FromExtension was set, but the asset path \"{0}\" has no extension")]
MissingExtension(AssetPath<'static>),
/// Cannot deduce file format from extension since this extension is unknown. Holds the
/// extension that could not be matched.
#[error("could not determine asset format for extension \"{0}\"")]
UnknownExtension(String),
/// [`Image::data`] is [`None`], so there is no data to save. See
/// [`RenderAssetUsages`](bevy_asset::RenderAssetUsages) for more.
#[error("the provided image does not contain any pixel data. Its data may live on the GPU (which we can't save out) due to `RenderAssetUsages`")]
ImageMissingData,
/// The image saver doesn't support the file format being requested.
#[error("the requested file format {0:?} is not supported for saving")]
UnsupportedFormat(ImageFormat),
/// The image saver doesn't support the texture format of the image data for the image format.
#[error("the image uses a texture format \"{1:?}\" that is not supported for saving by the image format \"{0:?}\"")]
UnsupportedSaveColorTypeForFormat(ImageFormat, TextureFormat),
/// The [`image`] crate returned an error.
#[error(transparent)]
ImageError(#[from] image::ImageError),
/// Writing the bytes returned an error.
#[error(transparent)]
IoError(#[from] std::io::Error),
}View on GitHub (pinned to 396ca72708)
Solutions
- Use a known image extension such as .png or .jpg
- Set an explicit format via SaveImageFormatSetting::Format(ImageFormat)
- Register support for the custom extension before saving
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/bevy_image/src/saver.rs:134 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/633b56a2e82468cc.
Report an issue: GitHub.