{"record":{"id":"c2b269a29397d049","repo":"bevyengine/bevy","slug":"scale-factor-0","errorCode":null,"errorMessage":"scale factor <= 0","messagePattern":"scale factor <= 0","errorType":"exception","errorClass":"TextError","httpStatus":null,"severity":"error","filePath":"crates/bevy_text/src/error.rs","lineNumber":29,"sourceCode":"    /// 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":11,"sourceCodeEnd":33,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_text/src/error.rs#L11-L33","documentation":"TextPipeline checks scale_factor <= 0.0 up front (crates/bevy_text/src/pipeline.rs:81-84), warns once ('Text scale factor is <= 0.0. No text will be displayed.') and returns TextError::DegenerateScaleFactor. Text layout and rendering are skipped entirely: a non-positive scale factor cannot map logical to physical pixels.","triggerScenarios":"Passing a zero or negative scale factor into text composition/queueing: a UiScale resource set to 0, a scale factor computed from a zero-sized window (minimized or not yet resized), or custom code calling the pipeline with an unvalidated factor.","commonSituations":"Setting UiScale(0.0) to 'hide' UI (breaks all text instead), platforms reporting scale 0 during window setup/minimize, division by a zero window dimension when deriving scale, or animating scale through 0 without clamping.","solutions":["Clamp the scale factor to a positive minimum before use: scale.max(f32::EPSILON) or a sane floor like 0.1","Skip text updates while the window is minimized or its size is 0","Check your UiScale resource and any tween/animation that drives it for zero crossings","Handle the error variant to fall back to the previous frame's layout instead of failing the system"],"exampleFix":"// before\nlet scale = window.width() / reference_width; // 0.0 when minimized\n\n// after\nlet scale = (window.width() / reference_width).max(0.1);","handlingStrategy":"validation","validationCode":"// Run before any text pipeline call\nfn safe_scale_factor(scale_factor: f32) -> f32 {\n    if scale_factor > 0.0 { scale_factor } else { 1.0 }\n}","typeGuard":null,"tryCatchPattern":"match pipeline.compose_or_queue(&mut font_atlas_sets, ..., scale_factor, ...) {\n    Err(TextError::DegenerateScaleFactor) => { /* keep last frame's layout */ }\n    r => r,\n}","preventionTips":["Clamp UiScale and derived scale factors to a positive floor","Skip text updates while the window is minimized or zero-sized","Never animate scale through zero; clamp the animation range"],"tags":["rust","bevy","text","scale-factor","window","ui"],"backgroundTag":"invalid-scale-factor","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"}