{"record":{"id":"8668e8c24f33d11a","repo":"bevyengine/bevy","slug":"missing-texture-atlas-layout-for-the-font","errorCode":null,"errorMessage":"missing texture atlas layout for the font","messagePattern":"missing texture atlas layout for the font","errorType":"exception","errorClass":"TextError","httpStatus":null,"severity":"error","filePath":"crates/bevy_text/src/error.rs","lineNumber":21,"sourceCode":"#[derive(Debug, PartialEq, Eq, Error)]\n/// Errors related to the textsystem\npub enum TextError {\n    /// Font was not found, this could be that the font has not yet been loaded, or\n    /// that the font failed to load for some other reason\n    #[error(\"font not found\")]\n    NoSuchFont,\n    /// Font was not found, this could be that the font has not yet been loaded, or\n    /// that the font failed to load for some other reason\n    #[error(\"No such font family {0:?}\")]\n    NoSuchFontFamily(String),\n    /// Failed to add glyph to a newly created atlas for some reason\n    #[error(\"failed to add glyph to newly-created atlas {0:?}\")]\n    FailedToAddGlyph(u16),\n    /// Failed to get scaled glyph image for cache key\n    #[error(\"failed to get scaled glyph image for cache key: {0:?}\")]\n    FailedToGetGlyphImage(u16),\n    /// Missing texture atlas layout for the font\n    #[error(\"missing texture atlas layout for the font\")]\n    MissingAtlasLayout,\n    /// Missing texture for the font atlas\n    #[error(\"missing texture for the font atlas\")]\n    MissingAtlasTexture,\n    /// Failed to find glyph in atlas after it was added\n    #[error(\"failed to find glyph in atlas after it was added\")]\n    InconsistentAtlasState,\n    #[error(\"scale factor <= 0\")]\n    /// Text cannot be rendered for a scale factor <= zero.\n    DegenerateScaleFactor,\n}\n","sourceCodeStart":3,"sourceCodeEnd":33,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_text/src/error.rs#L3-L33","documentation":"TextError::MissingAtlasLayout signals that the TextureAtlasLayout asset backing a font atlas is absent from Assets<TextureAtlasLayout>. In the current bevy_text the layout is held directly by FontAtlas, so this variant is declared in the public enum but no longer constructed in-tree; hitting it means custom code that manages atlas assets, or an older Bevy where FontAtlasSet looked the layout up by handle.","triggerScenarios":"Manually removing or replacing the TextureAtlasLayout assets owned by font atlases, calling older FontAtlasSet APIs that resolve a layout Handle, or third-party crates constructing this variant when the layout asset fails to load.","commonSituations":"Custom asset cleanup systems that clear Assets<T> collections wholesale, asset hot-reload paths that drop layouts, or version mismatches between Bevy and a UI/text crate compiled against the old atlas API.","solutions":["Audit custom systems for Assets::<TextureAtlasLayout>::remove/clear calls and stop deleting atlas-managed assets","If you keep a Handle<TextureAtlasLayout>, check assets.contains(&handle) before use and re-add the layout if missing","Upgrade Bevy and any third-party text/UI crates together so atlas APIs match"],"exampleFix":"// before: cleanup that also wipes font atlas layouts\nfor handle in all_handles { texture_atlas_layout_assets.remove(handle); }\n\n// after: only remove layouts your code created\nfor handle in my_own_layout_handles { texture_atlas_layout_assets.remove(handle); }","handlingStrategy":"validation","validationCode":"// Only valid if your code holds atlas layout handles\nif !texture_atlas_layouts.contains(&layout_handle) {\n    // re-create/re-add the layout, or skip this atlas\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(TextError::MissingAtlasLayout) => { /* recreate atlas state */ }\n    _ => {}\n}","preventionTips":["Never remove assets from Assets<TextureAtlasLayout> that you did not create","Keep Bevy and third-party text/UI crates on matching versions","Treat this variant as a signal that custom asset cleanup is too aggressive"],"tags":["rust","bevy","text","texture-atlas","assets"],"backgroundTag":"missing-atlas-layout","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}