{"record":{"id":"bc0bcdafe5c9fd65","repo":"bevyengine/bevy","slug":"rendertarget-image-missing-image-make-sure","errorCode":null,"errorMessage":"RenderTarget::Image missing ({image:?}): Make sure the Image's usages include RenderAssetUsages::MAIN_WORLD.","messagePattern":"RenderTarget::Image missing \\((.+?)\\): Make sure the Image's usages include RenderAssetUsages::MAIN_WORLD\\.","errorType":"exception","errorClass":"MissingRenderTargetInfoError","httpStatus":null,"severity":"error","filePath":"crates/bevy_render/src/camera.rs","lineNumber":334,"sourceCode":"        changed_image_handles: &HashSet<&AssetId<Image>>,\n    ) -> bool {\n        match self {\n            NormalizedRenderTarget::Window(window_ref) => {\n                changed_window_ids.contains(&window_ref.entity())\n            }\n            NormalizedRenderTarget::Image(image_target) => {\n                changed_image_handles.contains(&image_target.handle.id())\n            }\n            NormalizedRenderTarget::TextureView(_) | NormalizedRenderTarget::None { .. } => true,\n        }\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum MissingRenderTargetInfoError {\n    #[error(\"RenderTarget::Window missing ({window:?}): Make sure the provided entity has a Window component.\")]\n    Window { window: Entity },\n    #[error(\"RenderTarget::Image missing ({image:?}): Make sure the Image's usages include RenderAssetUsages::MAIN_WORLD.\")]\n    Image { image: AssetId<Image> },\n    #[error(\"RenderTarget::TextureView missing ({texture_view:?}): make sure the texture view handle was not removed.\")]\n    TextureView {\n        texture_view: ManualTextureViewHandle,\n    },\n}\n\n/// System in charge of updating a [`Camera`] when its window or projection changes.\n///\n/// The system detects window creation, resize, and scale factor change events to update the camera\n/// [`Projection`] if needed.\n///\n/// ## World Resources\n///\n/// [`Res<Assets<Image>>`](Assets<Image>) -- For cameras that render to an image, this resource is used to\n/// inspect information about the render target. This system will not access any other image assets.\n///\n/// [`OrthographicProjection`]: bevy_camera::OrthographicProjection","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_render/src/camera.rs#L316-L352","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create the target image with `RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD`","Keep the `Image` asset alive in `Assets<Image>` for as long as the camera targets it","If a texture must be render-world-only, do not assign it as a `RenderTarget::Image` that main-world systems query"],"exampleFix":"// before\nlet image = Image::new_fill(\n    Extent3d { width: 1280, height: 720, ..default() },\n    TextureDimension::D2,\n    &[0],\n    TextureFormat::Bgra8UnormSrgb,\n    RenderAssetUsages::RENDER_WORLD,\n);\n\n// after\nlet image = Image::new_fill(\n    Extent3d { width: 1280, height: 720, ..default() },\n    TextureDimension::D2,\n    &[0],\n    TextureFormat::Bgra8UnormSrgb,\n    RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD,\n);","handlingStrategy":"try-catch","validationCode":"// before using an image as a camera target\nlet usage_ok = image.asset_usage.contains(RenderAssetUsages::MAIN_WORLD);\nlet exists = images.contains(&handle);\nif usage_ok && exists {\n    camera.target = RenderTarget::Image(handle.clone());\n}","typeGuard":"fn image_target_ready(\n    handle: &Handle<Image>,\n    images: &Assets<Image>,\n) -> bool {\n    images.get(handle).is_some_and(|img| {\n        img.asset_usage.contains(RenderAssetUsages::MAIN_WORLD)\n    })\n}","tryCatchPattern":"match camera.target_info(windows, images, manual_texture_views) {\n    Err(MissingRenderTargetInfoError::Image { image }) => {\n        warn!(\"target image {image:?} not in main world; check RenderAssetUsages::MAIN_WORLD\");\n    }\n    other => { /* proceed */ }\n}","preventionTips":["Create camera-output images with MAIN_WORLD | RENDER_WORLD usages","Keep the target image asset alive while any camera uses it","Audit RenderAssetUsages when optimizing textures to RENDER_WORLD-only"],"tags":["bevy","camera","render-target","image","render-asset-usages"],"backgroundTag":"texture-usage-flags-missing","analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}