{"record":{"id":"e884135fd8279972","repo":"bevyengine/bevy","slug":"missing-texture-for-the-font-atlas","errorCode":null,"errorMessage":"missing texture for the font atlas","messagePattern":"missing texture for the font atlas","errorType":"exception","errorClass":"TextError","httpStatus":null,"severity":"error","filePath":"crates/bevy_text/src/error.rs","lineNumber":24,"sourceCode":"    /// 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":6,"sourceCodeEnd":33,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_text/src/error.rs#L6-L33","documentation":"Raised in FontAtlas::add_glyph (crates/bevy_text/src/font_atlas.rs:104): textures.get_mut(&self.texture) returns None, i.e. the Image asset that backs the font atlas no longer exists in Assets<Image>, so the glyph cannot be copied into the atlas.","triggerScenarios":"Anything that deletes or replaces the atlas Image asset while the font is still in use: Assets::<Image>::remove/clear from custom cleanup code, asset hot-reload that drops the image, or manual asset-server manipulation. The very next attempt to add a glyph for that font then fails.","commonSituations":"'Free VRAM' systems that clear the Image asset collection, editor tooling that recycles assets, hot-reloading a Font while cached atlases still reference the old Image handle, or mixing Bevy versions where atlas lifetimes changed.","solutions":["Find and remove any custom code that removes Images you did not load yourself (atlas textures are created internally by bevy_text)","On font hot-reload, also clear the FontAtlasSet/ComputedTextBlock state so atlases (and their textures) are recreated","If you must evict, evict whole fonts and let text re-queue, rather than deleting individual atlas images"],"exampleFix":"// before: evicts font atlas textures too\nimages.clear();\n\n// after: drop only your own images\nfor handle in my_images.drain(..) { images.remove(handle); }","handlingStrategy":"validation","validationCode":"// Before touching an atlas you manage yourself\nif !images.contains(&atlas_texture_handle) {\n    // texture was evicted; rebuild the atlas instead of adding glyphs\n}","typeGuard":null,"tryCatchPattern":"match atlas.add_glyph(textures, key, tex, offset, mask) {\n    Err(TextError::MissingAtlasTexture) => { /* rebuild FontAtlas with a fresh Image */ }\n    r => r,\n}","preventionTips":["Do not clear Assets<Image> wholesale; evict only handles you loaded","After font hot-reload, clear derived text state so atlases are recreated","Log before removing Image assets to catch accidental evictions early"],"tags":["rust","bevy","text","texture","assets","font-atlas"],"backgroundTag":"missing-texture-asset","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"}