{"record":{"id":"651dc0f9094f433b","repo":"bevyengine/bevy","slug":"failed-to-find-glyph-in-atlas-after-it-was-added","errorCode":null,"errorMessage":"failed to find glyph in atlas after it was added","messagePattern":"failed to find glyph in atlas after it was added","errorType":"exception","errorClass":"TextError","httpStatus":null,"severity":"error","filePath":"crates/bevy_text/src/error.rs","lineNumber":27,"sourceCode":"    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":9,"sourceCodeEnd":33,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_text/src/error.rs#L9-L33","documentation":"TextError::InconsistentAtlasState is returned at the end of add_glyph_to_atlas (crates/bevy_text/src/font_atlas.rs:186-187): the glyph was just inserted into an existing atlas or a newly pushed one, yet get_glyph_atlas_info cannot find the cache key in any atlas afterwards. It is an internal invariant break (insert claims success, lookup fails), not an expected user-error path.","triggerScenarios":"Effectively only reachable through a Bevy bug or corrupted FontAtlas state: cache-key mismatch between insert and lookup, another system mutating font_atlases concurrently, or state left inconsistent after prior errors (e.g. a FailedToAddGlyph path partially applied).","commonSituations":"Long-running apps with many fonts/sizes where atlas state drifted; custom code poking TextPipeline or FontAtlasSet internals; regressions in specific Bevy versions after refactors of the glyph cache.","solutions":["Update Bevy first; check the changelog for font-atlas / glyph-cache fixes","Reproduce with a minimal case (one font, one size, the failing string) and file an issue","As a runtime workaround, reset text state (despawn and respawn the text entities, or clear and rebuild the FontAtlasSet) to force fresh atlases","Never ignore it silently - log the font, size, and string to identify the trigger"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match add_glyph_to_atlas(...) {\n    Err(TextError::InconsistentAtlasState) => {\n        error!(\"glyph atlas cache is inconsistent; resetting text state\");\n        // rebuild FontAtlasSet / respawn text entities\n    }\n    r => r,\n}","preventionTips":["Update Bevy when font/atlas fixes ship","Avoid mutating TextPipeline/FontAtlasSet internals from custom systems","Capture font, size, and string when it fires so an upstream report is actionable"],"tags":["rust","bevy","text","glyph-cache","internal-invariant","font-atlas"],"backgroundTag":"cache-inconsistent-state","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"}