{"record":{"id":"27097450e6dd33d7","repo":"bevyengine/bevy","slug":"cannot-add-uninitialized-texture-to-atlas-270974","errorCode":null,"errorMessage":"cannot add uninitialized texture to atlas","messagePattern":"cannot add uninitialized texture to atlas","errorType":"exception","errorClass":"TextureAtlasBuilderError","httpStatus":null,"severity":"error","filePath":"crates/bevy_image/src/texture_atlas_builder.rs","lineNumber":28,"sourceCode":"use wgpu_types::{Extent3d, TextureDimension, TextureFormat};\n\nuse crate::{Image, TextureAccessError, TextureFormatPixelInfo};\nuse crate::{TextureAtlasLayout, TextureAtlasSources};\n\n/// Errors returned by [`TextureAtlasBuilder`].\n#[derive(Debug, Error)]\npub enum TextureAtlasBuilderError {\n    /// The atlas texture wasn't large enough to fit the texture\n    #[error(\"could not pack textures into an atlas within the given bounds\")]\n    NotEnoughSpace,\n    /// Attempted to add a texture with a different format\n    #[error(\"added a texture with the wrong format in an atlas\")]\n    WrongFormat,\n    /// Attempted to add a texture to an uninitialized atlas\n    #[error(\"cannot add texture to uninitialized atlas texture\")]\n    UninitializedAtlas,\n    /// Attempted to add an uninitialized texture to an atlas\n    #[error(\"cannot add uninitialized texture to atlas\")]\n    UninitializedSourceTexture,\n    /// A texture access error occurred\n    #[error(\"texture access error: {0}\")]\n    TextureAccess(#[from] TextureAccessError),\n}\n\n#[derive(Debug)]\n#[must_use]\n/// A builder which is used to create a texture atlas from many individual\n/// sprites.\npub struct TextureAtlasBuilder<'a> {\n    /// Collection of texture's asset id (optional) and image data to be packed into an atlas\n    textures_to_place: Vec<(Option<AssetId<Image>>, &'a Image)>,\n    /// The initial atlas size in pixels.\n    initial_size: UVec2,\n    /// The absolute maximum size of the texture atlas in pixels.\n    max_size: UVec2,\n    /// The texture format for the textures that will be loaded in the atlas.","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_image/src/texture_atlas_builder.rs#L10-L46","documentation":"TextureAtlasBuilderError::NoTextureData — the Image being added has no CPU pixel data (data is None), so its contents cannot be copied into the atlas. This happens for GPU-resident images created with render-only RenderAssetUsages; supply an image with main-world data.","triggerScenarios":"Thrown at crates/bevy_image/src/texture_atlas_builder.rs:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the image asset is fully loaded and has pixel data before adding it to the atlas","Skip uninitialized images during atlas construction"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}