{"record":{"id":"71b4e58a15d69076","repo":"iced-rs/iced","slug":"create-window","errorCode":null,"errorMessage":"Create window","messagePattern":"Create window","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"winit/src/lib.rs","lineNumber":337,"sourceCode":"                                    window_attributes.with_canvas(self.canvas.take())\n                                };\n\n                                log::info!(\n                                    \"Window attributes for id `{id:#?}`: {window_attributes:#?}\"\n                                );\n\n                                // On macOS, the `position` in `WindowAttributes` represents the \"inner\"\n                                // position of the window; while on other platforms it's the \"outer\" position.\n                                // We fix the inconsistency on macOS by positioning the window after creation.\n                                #[cfg(target_os = \"macos\")]\n                                let mut window_attributes = window_attributes;\n\n                                #[cfg(target_os = \"macos\")]\n                                let position = window_attributes.position.take();\n\n                                let window = event_loop\n                                    .create_window(window_attributes)\n                                    .expect(\"Create window\");\n\n                                #[cfg(target_os = \"macos\")]\n                                if let Some(position) = position {\n                                    window.set_outer_position(position);\n                                }\n\n                                #[cfg(target_arch = \"wasm32\")]\n                                {\n                                    use winit::platform::web::WindowExtWebSys;\n\n                                    let canvas = window.canvas().expect(\"Get window canvas\");\n\n                                    let _ = canvas.set_attribute(\n                                        \"style\",\n                                        \"display: block; width: 100%; height: 100%\",\n                                    );\n\n                                    let window = web_sys::window().unwrap();","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/iced-rs/iced/blob/fa3bae52874274c012a27d4bf11a83c49e1709ae/winit/src/lib.rs#L319-L355","documentation":"iced's winit runtime panics when event_loop.create_window(window_attributes) fails during process_event's Resumed/window-setup handling. winit returns an error when the platform rejects window creation (invalid attributes, display server failure, resource limits); since the app cannot run without its main window, iced uses expect.","triggerScenarios":"Creating a window with unsupported/invalid WindowAttributes (bad icon, impossible position, incompatible settings), when the display connection is broken, or when the OS refuses a new window (resource exhaustion, sandbox restrictions).","commonSituations":"Corrupt or oversized window icon bytes; window_settings loaded from a config file with out-of-bounds position/size; Wayland compositor rejecting client-side decorations; running out of file descriptors; flatpak/sandbox missing portal permissions.","solutions":["Inspect window()/Window::Settings values (size, position, icon) and fix out-of-range or invalid entries, especially if loaded from config.","Verify the display connection is healthy and try a simpler settings set (no icon, default position) to isolate the failing attribute.","Check system limits (ulimit -n for file descriptors) and sandbox/portal permissions.","Update iced/winit - platform-specific create_window bugs are periodically fixed."],"exampleFix":"// before\nWindow::Settings { position: Position::Specific(-99999.0, -99999.0), .. }\n// after\nWindow::Settings { position: Position::Default, .. }","handlingStrategy":"validation","validationCode":"// validate window settings loaded from config before passing to iced\nfn valid(s: &iced::window::Settings) -> bool {\n    s.size.0 > 0 && s.size.1 > 0 && s.size.0 < u32::MAX / 2 && s.size.1 < u32::MAX / 2\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate Window::Settings (size, position, icon) loaded from config files.","Test with minimal settings to isolate invalid attributes.","Check ulimit -n and sandbox/portal permissions on constrained systems.","Keep window icons small and valid (correctly encoded)."],"tags":["winit","window","panic","platform"],"backgroundTag":"window-creation-failed","analyzedSha":"fa3bae52874274c012a27d4bf11a83c49e1709ae","analyzedAt":"2026-09-11T16:54:14.229Z","contentChangedAt":"2026-09-11T16:54:14.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}