{"record":{"id":"441643556f0ece37","repo":"bevyengine/bevy","slug":"system-input-value-was-not-found-did-you-forget-t","errorCode":null,"errorMessage":"System input value was not found. Did you forget to initialize the system before running it?","messagePattern":"System input value was not found\\. Did you forget to initialize the system before running it\\?","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_ecs/src/system/schedule_system.rs","lineNumber":159,"sourceCode":"\n    fn name(&self) -> DebugName {\n        self.system.name()\n    }\n\n    #[inline]\n    fn flags(&self) -> SystemStateFlags {\n        self.system.flags()\n    }\n\n    unsafe fn run_unsafe(\n        &mut self,\n        _input: SystemIn<'_, Self>,\n        world: UnsafeWorldCell,\n    ) -> Result<Self::Out, RunSystemError> {\n        let value = self\n            .value\n            .as_mut()\n            .expect(\"System input value was not found. Did you forget to initialize the system before running it?\");\n        // SAFETY: Upheld by caller\n        unsafe { self.system.run_unsafe(value, world) }\n    }\n\n    #[cfg(feature = \"hotpatching\")]\n    #[inline]\n    fn refresh_hotpatch(&mut self) {\n        self.system.refresh_hotpatch();\n    }\n\n    fn apply_deferred(&mut self, world: &mut World) {\n        self.system.apply_deferred(world);\n    }\n\n    fn queue_deferred(&mut self, world: DeferredWorld) {\n        self.system.queue_deferred(world);\n    }\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/system/schedule_system.rs#L141-L177","documentation":"WithInputFromWrapper (created by IntoSystem::with_input_from) lazily constructs its input value in System::initialize via T::from_world(world). run_unsafe expects that to have happened; running the system before initialize leaves value as None and this expect panics. It is the use-before-initialize guard for lazily-created system inputs.","triggerScenarios":"Calling run_unsafe on a system produced with .with_input_from(..) before any initialize call: manual runs in tests/tools, custom executors that skip initialization, or scheduling code that bypasses the normal initialize-then-run order.","commonSituations":"Running piped-input systems manually outside schedules; executors that run systems without initializing them first; porting from eagerly-supplied inputs to with_input_from without adding an initialization step.","solutions":["Call system.initialize(&mut world) once before run_unsafe - schedules do this automatically on first run (initialize creates the value via T::from_world).","Or use the eager variant: supply the value with .with_input(value) instead of with_input_from.","For one-off runs, use safe helpers such as world.run_system_once which handle initialization."],"exampleFix":"// before\nlet mut sys = my_system.with_input_from();\nunsafe { sys.run_unsafe((), world.into()) }; // panic: input value never created\n\n// after\nlet mut sys = my_system.with_input_from();\nsys.initialize(&mut world); // creates the input via GameInput::from_world\nunsafe { sys.run_unsafe((), world.into()) };","handlingStrategy":"validation","validationCode":"if wrapper.value().is_none() {\n    wrapper.initialize(&mut world); // triggers T::from_world and fills the value\n}\n// run only after the value exists","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize systems before run_unsafe, or run them through schedules.","Prefer .with_input(value) when you can construct the input eagerly.","Use world.run_system_once for one-off runs in tests."],"tags":["bevy","ecs","system","input","initialization","panic"],"backgroundTag":"use-before-initialize","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}