bevyengine/bevy · error · MissingRenderTargetInfoError

RenderTarget::Image missing ({image:?}): Make sure the Image

Error message

RenderTarget::Image missing ({image:?}): Make sure the Image's usages include RenderAssetUsages::MAIN_WORLD.

What it means

The `Image` variant of `MissingRenderTargetInfoError` is returned when `RenderTarget::Image(handle)` cannot be found in the main-world `Assets<Image>` during `Camera::target_info`. As the message states, the typical cause is an image created with `RenderAssetUsages::RENDER_WORLD` only, so it does not exist in the main world where camera target info is resolved.

Source

Thrown at crates/bevy_render/src/camera.rs:334

        changed_image_handles: &HashSet<&AssetId<Image>>,
    ) -> bool {
        match self {
            NormalizedRenderTarget::Window(window_ref) => {
                changed_window_ids.contains(&window_ref.entity())
            }
            NormalizedRenderTarget::Image(image_target) => {
                changed_image_handles.contains(&image_target.handle.id())
            }
            NormalizedRenderTarget::TextureView(_) | NormalizedRenderTarget::None { .. } => true,
        }
    }
}

#[derive(Debug, thiserror::Error)]
pub enum MissingRenderTargetInfoError {
    #[error("RenderTarget::Window missing ({window:?}): Make sure the provided entity has a Window component.")]
    Window { window: Entity },
    #[error("RenderTarget::Image missing ({image:?}): Make sure the Image's usages include RenderAssetUsages::MAIN_WORLD.")]
    Image { image: AssetId<Image> },
    #[error("RenderTarget::TextureView missing ({texture_view:?}): make sure the texture view handle was not removed.")]
    TextureView {
        texture_view: ManualTextureViewHandle,
    },
}

/// System in charge of updating a [`Camera`] when its window or projection changes.
///
/// The system detects window creation, resize, and scale factor change events to update the camera
/// [`Projection`] if needed.
///
/// ## World Resources
///
/// [`Res<Assets<Image>>`](Assets<Image>) -- For cameras that render to an image, this resource is used to
/// inspect information about the render target. This system will not access any other image assets.
///
/// [`OrthographicProjection`]: bevy_camera::OrthographicProjection

View on GitHub (pinned to 8d743eb7dc)

Solutions

  1. Create the target image with `RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD`
  2. Keep the `Image` asset alive in `Assets<Image>` for as long as the camera targets it
  3. If a texture must be render-world-only, do not assign it as a `RenderTarget::Image` that main-world systems query

Example fix

// before
let image = Image::new_fill(
    Extent3d { width: 1280, height: 720, ..default() },
    TextureDimension::D2,
    &[0],
    TextureFormat::Bgra8UnormSrgb,
    RenderAssetUsages::RENDER_WORLD,
);

// after
let image = Image::new_fill(
    Extent3d { width: 1280, height: 720, ..default() },
    TextureDimension::D2,
    &[0],
    TextureFormat::Bgra8UnormSrgb,
    RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD,
);
Defensive patterns

Strategy: try-catch

Validate before calling

// before using an image as a camera target
let usage_ok = image.asset_usage.contains(RenderAssetUsages::MAIN_WORLD);
let exists = images.contains(&handle);
if usage_ok && exists {
    camera.target = RenderTarget::Image(handle.clone());
}

Type guard

fn image_target_ready(
    handle: &Handle<Image>,
    images: &Assets<Image>,
) -> bool {
    images.get(handle).is_some_and(|img| {
        img.asset_usage.contains(RenderAssetUsages::MAIN_WORLD)
    })
}

Try / catch

match camera.target_info(windows, images, manual_texture_views) {
    Err(MissingRenderTargetInfoError::Image { image }) => {
        warn!("target image {image:?} not in main world; check RenderAssetUsages::MAIN_WORLD");
    }
    other => { /* proceed */ }
}

Prevention

When it happens

Trigger: Creating a render-target image with `RenderAssetUsages::RENDER_WORLD` (or without MAIN_WORLD in its `asset_usage`) and using it as a camera target; or the image asset being removed from `Assets<Image>` while the camera still targets it.

Common situations: Optimizing textures to RENDER_WORLD-only and accidentally including the camera's output target; UI/image-saving or screenshot features reading the target in the main world; asset unload during scene transitions.

Related errors


AI-assisted analysis of bevyengine/bevy@8d743eb7dc (2026-08-20). Data as JSON: /api/errors/bc0bcdafe5c9fd65. Report an issue: GitHub.