{"record":{"id":"d0823c800fd4a083","repo":"FyroxEngine/Fyrox","slug":"window-width-was","errorCode":null,"errorMessage":"Window width was {}","messagePattern":"Window width was (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"fyrox-ui/src/window.rs","lineNumber":584,"sourceCode":"            } else if message.destination() == self.close_button {\n                ui.send(self.handle(), WindowMessage::Close);\n            }\n        } else if let Some(msg) = message.data_for::<WindowMessage>(self.handle()) {\n            match msg {\n                &WindowMessage::Open {\n                    alignment,\n                    modal,\n                    focus_content,\n                } => {\n                    // Only manage this window's visibility if it is at the root.\n                    // Otherwise, it is part of something like a tile, and that parent should decide\n                    // whether the window is visible.\n                    if !self.visibility() && self.parent() == ui.root() {\n                        ui.send(self.handle(), WidgetMessage::Visibility(true));\n                        // If we are opening the window with non-finite width and height, something\n                        // has gone wrong, so correct it.\n                        if !self.width().is_finite() {\n                            Log::err(format!(\"Window width was {}\", self.width()));\n                            self.set_width(200.0);\n                        }\n                        if !self.height().is_finite() {\n                            Log::err(format!(\"Window height was {}\", self.height()));\n                            self.set_height(200.0);\n                        }\n                    }\n                    ui.send(self.handle(), WidgetMessage::Topmost);\n                    if focus_content {\n                        ui.send(self.content_to_focus(), WidgetMessage::Focus);\n                    }\n                    if modal && !ui.restricts_picking(self.handle()) {\n                        ui.push_picking_restriction(RestrictionEntry {\n                            handle: self.handle(),\n                            stop: true,\n                        });\n                    }\n                    match alignment {","sourceCodeStart":566,"sourceCodeEnd":602,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-ui/src/window.rs#L566-L602","documentation":"When a root-level Window is made visible it checks its dimensions. If the width is non-finite (NaN or infinity) the window would render incorrectly, so it is logged and forcibly reset to 200.0 pixels.","triggerScenarios":"Showing a Window (`WidgetMessage::Visibility(true)`) whose width is NaN/inf — e.g. WindowBuilder given non-finite desired width, or width computed from invalid layout math; only applies when the window is a child of the UI root.","commonSituations":"Passing computed sizes (from division by zero or uninitialized variables) into WindowBuilder; loading window geometry from corrupted config files containing NaN; forgetting to set an initial width.","solutions":["Set a finite explicit width in WindowBuilder: `.with_width(400.0)`","Validate window geometry loaded from config/user settings before applying (reject NaN/inf)","Find the source of the NaN/inf in your size computation (division by zero, uninitialized f32)","Rely on the library fallback only as a stopgap — it clamps to 200.0 which may not be desired"],"exampleFix":"// before\nlet width = saved_size[0] / scale_factor; // may be NaN\nWindowBuilder::new(...).with_width(width)\n// after\nlet width = saved_size[0] / scale_factor;\nlet width = if width.is_finite() { width } else { 400.0 };\nWindowBuilder::new(...).with_width(width)","handlingStrategy":"validation","validationCode":"fn finite_dim(v: f32, fallback: f32) -> f32 {\n    if v.is_finite() { v } else { fallback }\n}\nlet width = finite_dim(config.width, 400.0);","typeGuard":"fn is_finite_size(w: f32, h: f32) -> bool { w.is_finite() && h.is_finite() }","tryCatchPattern":null,"preventionTips":["Always pass explicit finite sizes to WindowBuilder","Sanitize geometry restored from config files","Guard arithmetic that can produce NaN (division, sqrt of negatives)"],"tags":["ui","window","layout","non-finite"],"backgroundTag":"invalid-argument-value","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}