{"record":{"id":"e10031b1231b4d7c","repo":"iced-rs/iced","slug":"compositor-must-be-initialized","errorCode":null,"errorMessage":"Compositor must be initialized","messagePattern":"Compositor must be initialized","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"winit/src/lib.rs","lineNumber":630,"sourceCode":"                }\n\n                let window_theme = window\n                    .theme()\n                    .map(conversion::theme_mode)\n                    .unwrap_or_default();\n\n                if system_theme != window_theme {\n                    system_theme = window_theme;\n\n                    runtime.broadcast(subscription::Event::SystemThemeChanged(window_theme));\n                }\n\n                let is_first = window_manager.is_empty();\n                let window = window_manager.insert(\n                    id,\n                    window,\n                    &program,\n                    compositor.as_mut().expect(\"Compositor must be initialized\"),\n                    proxy.clone(),\n                    renderer_settings,\n                    exit_on_close_request,\n                    system_theme,\n                );\n\n                window\n                    .raw\n                    .set_theme(conversion::window_theme(window.state.theme_mode()));\n\n                debug::theme_changed(|| {\n                    if is_first {\n                        theme::Base::seed(window.state.theme())\n                    } else {\n                        None\n                    }\n                });\n","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/iced-rs/iced/blob/d146509d893945de5c304cfaf4301335eee278bd/winit/src/lib.rs#L612-L648","documentation":"Panic from `compositor.as_mut().expect(\"Compositor must be initialized\")` when inserting a new window into window_manager. The code guarantees the compositor was created in the block above (or a Crash control message was sent and the loop continued), so None here signals an internal invariant violation.","triggerScenarios":"The Event::WindowCreated branch falls through to window_manager.insert with compositor still None — only possible if the compositor-creation block was skipped or a future refactor sends Crash without `continue`, or the oneshot handshake failed silently.","commonSituations":"Patched/forked iced code where the `continue` after Control::Crash was removed; exotic backends where compositor creation returns Err and control flow diverges.","solutions":["Do not modify the Control::Crash handling — keep the `continue` so insertion is skipped","Update to upstream iced","If forking, replace the expect with proper error propagation to Control::Crash"],"exampleFix":"// before\nlet window = window_manager.insert(id, window, &program, compositor.as_mut().expect(\"Compositor must be initialized\"), ...);\n// after\nlet Some(compositor) = compositor.as_mut() else { let _ = control_sender.start_send(Control::Crash(\"compositor missing\".into())); continue; };\nlet window = window_manager.insert(id, window, &program, compositor, ...);","handlingStrategy":"type-guard","validationCode":"// if forking: check compositor.is_some() before inserting the window","typeGuard":"let Some(compositor) = compositor.as_mut() else { return; };","tryCatchPattern":null,"preventionTips":["Don't remove the `continue` after Control::Crash in forked code","Track upstream changes to run_instance carefully when patching","Test crash-path behavior (e.g. with an invalid backend setting) in CI"],"tags":["panic","compositor","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"d146509d893945de5c304cfaf4301335eee278bd","analyzedAt":"2026-09-11T16:54:14.229Z","contentChangedAt":"2026-09-11T16:54:14.229Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}