{"record":{"id":"828e2ea2e63a83c8","repo":"emilk/egui","slug":"run-ui-should-only-be-called-with-appkind-ui-or-a","errorCode":null,"errorMessage":"run_ui should only be called with AppKind::Ui or AppKind::UiState","messagePattern":"run_ui should only be called with AppKind::Ui or AppKind::UiState","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/egui_kittest/src/app_kind.rs","lineNumber":67,"sourceCode":"                app.logic(ui, frame);\n                app.ui(ui, frame);\n                None\n            }\n            kind_ui => Some(kind_ui.run_ui(ui, state, sizing_pass)),\n        }\n    }\n\n    fn run_ui(&mut self, ui: &mut egui::Ui, state: &mut State, sizing_pass: bool) -> UiRunOutput {\n        let mut builder = egui::UiBuilder::new();\n        if sizing_pass {\n            builder.sizing_pass = true;\n        }\n        let egui::InnerResponse {\n            inner: ui_id,\n            response,\n        } = ui.scope_builder(builder, |ui| {\n            Frame::central_panel(ui.style())\n                // Only set outer margin, so we show no frame for tests with only free-floating windows/popups:\n                .outer_margin(8.0)\n                .inner_margin(0.0)\n                .show(ui, |ui| {\n                    match self {\n                        AppKind::Ui(f) => f(ui),\n                        AppKind::UiState(f) => f(ui, state),\n                        #[cfg(feature = \"eframe\")]\n                        AppKind::Eframe(_) => unreachable!(\n                            \"run_ui should only be called with AppKind::Ui or AppKind::UiState\"\n                        ),\n                    }\n                    ui.scope_id()\n                })\n                .inner\n        });\n        UiRunOutput { response, ui_id }\n    }\n}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/emilk/egui/blob/8fb03c9ae9a6bf1ffa602dfba51ed575f2655975/crates/egui_kittest/src/app_kind.rs#L49-L85","documentation":"Error \"run_ui should only be called with AppKind::Ui or AppKind::UiState\" thrown in emilk/egui.","triggerScenarios":"Thrown at crates/egui_kittest/src/app_kind.rs:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call run_ui only on a Harness created with AppKind::Ui or AppKind::UiState; for other app kinds use the appropriate run method."],"exampleFix":"let mut harness = Harness::new_ui(|ui| { ui.label(\"hi\"); }); harness.run_ui(|ctx| {});","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8fb03c9ae9a6bf1ffa602dfba51ed575f2655975","analyzedAt":"2026-08-19T12:39:57.743Z","contentChangedAt":"2026-08-19T12:39:57.743Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}