{"record":{"id":"934fafe0da2d79af","repo":"emilk/egui","slug":"single-use-appcreator-has-unexpectedly-already-bee","errorCode":null,"errorMessage":"Single-use AppCreator has unexpectedly already been taken","messagePattern":"Single-use AppCreator has unexpectedly already been taken","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/eframe/src/native/glow_integration.rs","lineNumber":343,"sourceCode":"                ..\n            } = viewport\n            {\n                egui_winit.init_accesskit(event_loop, window, event_loop_proxy);\n            }\n        }\n\n        if self\n            .native_options\n            .viewport\n            .mouse_passthrough\n            .unwrap_or(false)\n            && let Err(err) = glutin.window(ViewportId::ROOT).set_cursor_hittest(false)\n        {\n            log::warn!(\"set_cursor_hittest(false) failed: {err}\");\n        }\n\n        let app_creator = core::mem::take(&mut self.app_creator)\n            .expect(\"Single-use AppCreator has unexpectedly already been taken\");\n\n        crate::maybe_attach_inspection_plugin(&integration.egui_ctx, Some(self.app_name.clone()));\n\n        let app: Box<dyn 'app + App> = {\n            // Use latest raw_window_handle for eframe compatibility\n            use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _};\n\n            let gl_config = glutin.gl_config.clone();\n            let get_proc_address = move |addr: &_| gl_config.display().get_proc_address(addr);\n            let window = glutin.window(ViewportId::ROOT);\n            let cc = CreationContext {\n                egui_ctx: integration.egui_ctx.clone(),\n                integration_info: integration.frame.info().clone(),\n                storage: integration.frame.storage(),\n                gl: Some(gl),\n                get_proc_address: Some(Arc::new(get_proc_address)),\n                #[cfg(feature = \"wgpu_no_default_features\")]\n                wgpu_render_state: None,","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/emilk/egui/blob/d802a982ce959839d92f4f6718fdffa41143110e/crates/eframe/src/native/glow_integration.rs#L325-L361","documentation":"eframe stores your AppCreator closure in an Option and consumes it exactly once with core::mem::take when the root viewport is first created inside the event loop. This expect fires when the creation path is entered a second time after the closure was already taken: the event loop delivered Resumed/init twice (classic Android suspend/resume lifecycle) or the runner state was re-entered after a restart.","triggerScenarios":"Entering the Glow backend's root-window creation twice in one process: duplicate winit Resumed events on Android, re-running the event loop on a reused runner, or a winit/eframe version mismatch that re-delivers initialization events.","commonSituations":"Android apps where the Activity is suspended and recreated (second Resumed event); upgrading winit across event-loop API changes; embedding eframe in a host framework that restarts the GUI loop in the same process.","solutions":["Update eframe to the latest patch release (Android lifecycle double-resume handling has been fixed and refactored over time).","Ensure run_native / the event loop is started exactly once per process.","On Android, treat Activity recreation as a fresh process: recreate the runner state instead of re-entering the old one.","If reproducible on current eframe, report with the backtrace and lifecycle events seen."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call eframe::run_native (or start the event loop) exactly once per process; never reuse a runner after it has run.","On Android, assume Activity recreation starts a fresh run; do not cache eframe runner state across suspend/resume.","Track eframe patch releases — lifecycle double-resume fixes land there.","Set RUST_BACKTRACE=1 in dev builds so a hit shows which event path re-entered creation."],"tags":["rust","eframe","app-lifecycle","android","event-loop","panic"],"backgroundTag":"double-initialization","analyzedSha":"d802a982ce959839d92f4f6718fdffa41143110e","analyzedAt":"2026-08-16T20:07:53.954Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}