bevyengine/bevy · error · SaveImageError
SaveImageFormatSetting::FromExtension was set, but the…
Error message
SaveImageFormatSetting::FromExtension was set, but the asset path "{0}" has no extension What it means
SaveImageError variant raised when the image saver is configured with SaveImageFormatSetting::FromExtension (the default) but the target AssetPath carries no file extension, so no format can be deduced. Fix by giving the path an extension or setting an explicit Format(ImageFormat).
Solutions
- Give the asset path a file extension (e.g. .png)
- Set an explicit format via SaveImageFormatSetting::Format(ImageFormat) instead of relying on the extension
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_image/src/saver.rs:130 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/db8c0b9297f87d6a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/bevy_image/src/saver.rs:130
/// Defines the file format that the image will be saved as.
pub format: SaveImageFormatSetting,
}
/// 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),View on GitHub (pinned to 396ca72708)