FyroxEngine/Fyrox · warning
Window width was
Error message
Window width was {} What it means
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.
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
Example fix
// before
let width = saved_size[0] / scale_factor; // may be NaN
WindowBuilder::new(...).with_width(width)
// after
let width = saved_size[0] / scale_factor;
let width = if width.is_finite() { width } else { 400.0 };
WindowBuilder::new(...).with_width(width) Defensive patterns
Strategy: validation
Validate before calling
fn finite_dim(v: f32, fallback: f32) -> f32 {
if v.is_finite() { v } else { fallback }
}
let width = finite_dim(config.width, 400.0); Type guard
fn is_finite_size(w: f32, h: f32) -> bool { w.is_finite() && h.is_finite() } Prevention
- Always pass explicit finite sizes to WindowBuilder
- Sanitize geometry restored from config files
- Guard arithmetic that can produce NaN (division, sqrt of negatives)
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Window height was
- Node row out of bounds
- Node column out of bounds
- Cannot add window to split tile
- Cannot subtract window from split tile
AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10).
Data as JSON: /api/errors/d0823c800fd4a083.
Report an issue: GitHub.
Appendix: source
Thrown at fyrox-ui/src/window.rs:584
} else if message.destination() == self.close_button {
ui.send(self.handle(), WindowMessage::Close);
}
} else if let Some(msg) = message.data_for::<WindowMessage>(self.handle()) {
match msg {
&WindowMessage::Open {
alignment,
modal,
focus_content,
} => {
// Only manage this window's visibility if it is at the root.
// Otherwise, it is part of something like a tile, and that parent should decide
// whether the window is visible.
if !self.visibility() && self.parent() == ui.root() {
ui.send(self.handle(), WidgetMessage::Visibility(true));
// If we are opening the window with non-finite width and height, something
// has gone wrong, so correct it.
if !self.width().is_finite() {
Log::err(format!("Window width was {}", self.width()));
self.set_width(200.0);
}
if !self.height().is_finite() {
Log::err(format!("Window height was {}", self.height()));
self.set_height(200.0);
}
}
ui.send(self.handle(), WidgetMessage::Topmost);
if focus_content {
ui.send(self.content_to_focus(), WidgetMessage::Focus);
}
if modal && !ui.restricts_picking(self.handle()) {
ui.push_picking_restriction(RestrictionEntry {
handle: self.handle(),
stop: true,
});
}
match alignment {View on GitHub (pinned to 76c91aad8e)