{"record":{"id":"cbe9529c754bf5b8","repo":"bevyengine/bevy","slug":"should-register-settimeout","errorCode":null,"errorMessage":"Should register `setTimeout`.","messagePattern":"Should register `setTimeout`\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_app/src/schedule_runner.rs","lineNumber":130,"sourceCode":"                            let exe_time = end_time - start_time;\n                            if exe_time < wait {\n                                return Ok(Some(wait - exe_time));\n                            }\n                        }\n\n                        Ok(None)\n                    };\n\n                    cfg_select! {\n                        all(target_arch = \"wasm32\", feature = \"web\") => {\n                            fn set_timeout(callback: &Closure<dyn FnMut()>, dur: Duration) {\n                                web_sys::window()\n                                    .unwrap()\n                                    .set_timeout_with_callback_and_timeout_and_arguments_0(\n                                        callback.as_ref().unchecked_ref(),\n                                        dur.as_millis() as i32,\n                                    )\n                                    .expect(\"Should register `setTimeout`.\");\n                            }\n                            let asap = Duration::from_millis(1);\n\n                            let exit = Rc::new(RefCell::new(AppExit::Success));\n                            let closure_exit = exit.clone();\n\n                            let mut app = Rc::new(app);\n                            let moved_tick_closure = Rc::new(RefCell::new(None));\n                            let base_tick_closure = moved_tick_closure.clone();\n\n                            let tick_app = move || {\n                                let app = Rc::get_mut(&mut app).unwrap();\n                                let delay = tick(app, wait);\n                                match delay {\n                                    Ok(delay) => set_timeout(\n                                        moved_tick_closure.borrow().as_ref().unwrap(),\n                                        delay.unwrap_or(asap),\n                                    ),","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_app/src/schedule_runner.rs#L112-L148","documentation":"An expect() failure inside the wasm32 schedule runner build path: the code reaches a branch that requires a registered setTimeout callback (via web_sys::window()), but the browser window/global is unavailable. This is an environment/setup guard on wasm targets, indicating the app is not running inside a proper browser context or the web feature setup is inconsistent.","triggerScenarios":"Thrown at crates/bevy_app/src/schedule_runner.rs:130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the app is actually running in a browser environment (wasm32 target with the web feature enabled)","Enter the app through the #[bevy_main] macro / wasm runner so the browser globals are initialized","Verify web-sys window access is not happening in a worker or non-window context without a fallback runner"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}