bevyengine/bevy · error · SaveImageError

the provided image does not contain any pixel data. Its data

Error message

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`

What it means

SaveImageError variant raised when Image::data is None because the image's pixel data was kept GPU-only via RenderAssetUsages (e.g. RENDER_USAGE main-world images). The CPU has no bytes to serialize; re-create the image with MAIN_WORLD | SAVE_USAGE or copy data back before saving.

Source

Thrown at crates/bevy_image/src/saver.rs:138

    #[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),
}

#[cfg(test)]
mod tests {
    use std::path::Path;

View on GitHub (pinned to 396ca72708)

Solutions

  1. Create the image with RenderAssetUsages::MAIN_WORLD (or not RENDER_WORLD only) so CPU data is retained
  2. Read the texture back from the GPU before saving
  3. Maintain a separate CPU-side copy of the image for saving
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/bevy_image/src/saver.rs:138 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/e4a05305475ce22e. Report an issue: GitHub.