{"record":{"id":"959eab28a02eb64d","repo":"bevyengine/bevy","slug":"error-calling-hotpatched-system-run-a-full-rebuil","errorCode":null,"errorMessage":"Error calling hotpatched system. Run a full rebuild","messagePattern":"Error calling hotpatched system\\. Run a full rebuild","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/system/exclusive_function_system.rs","lineNumber":131,"sourceCode":"        world.last_change_tick_scope(self.system_meta.last_run, |world| {\n            #[cfg(feature = \"trace\")]\n            let _span_guard = self.system_meta.system_span.enter();\n\n            let params = F::Param::get_param(\n                self.param_state.as_mut().expect(PARAM_MESSAGE),\n                &self.system_meta,\n            )?;\n\n            #[cfg(feature = \"hotpatching\")]\n            let out = {\n                let mut hot_fn =\n                    subsecond::HotFn::current(<F as ExclusiveSystemParamFunction<Marker>>::run);\n                // SAFETY:\n                // - pointer used to call is from the current jump table\n                unsafe {\n                    hot_fn\n                        .try_call_with_ptr(self.current_ptr, (&mut self.func, world, input, params))\n                        .expect(\"Error calling hotpatched system. Run a full rebuild\")\n                }\n            };\n            #[cfg(not(feature = \"hotpatching\"))]\n            let out = self.func.run(world, input, params);\n\n            world.flush();\n            self.system_meta.last_run = world.increment_change_tick();\n\n            IntoResult::into_result(out)\n        })\n    }\n\n    #[cfg(feature = \"hotpatching\")]\n    #[inline]\n    fn refresh_hotpatch(&mut self) {\n        let new = subsecond::HotFn::current(<F as ExclusiveSystemParamFunction<Marker>>::run)\n            .ptr_address();\n        if new != self.current_ptr {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/system/exclusive_function_system.rs#L113-L149","documentation":"With the hotpatching feature, exclusive function systems execute through subsecond jump-table function pointers instead of direct calls. try_call_with_ptr fails when the stored current_ptr no longer refers to the current jump table - typically because a hot patch was applied but this system's pointer was not refreshed via refresh_hotpatch. The expect then panics with this message; the remedy is a full rebuild.","triggerScenarios":"A subsecond hot patch landed while the app was running or paused and the system's cached pointer went stale because refresh_hotpatch was not propagated to it; resuming execution after a partially applied patch.","commonSituations":"Iterating with hotpatching enabled and patching while paused at a breakpoint; systems held outside schedules (cached in resources) that never receive the refresh; reload-sequencing bugs in the hot-reload tooling.","solutions":["Do a full rebuild and restart of the application as the message says - the jump table and all pointers are then recreated consistently.","Ensure the system participates in the normal refresh path: systems inside schedules get refresh_hotpatch on reload; if you cache one outside a schedule, call refresh_hotpatch on it after each patch.","If it recurs for systems that do live in schedules, report it - the refresh propagation missed that system."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply hot patches while schedules are not mid-run so the refresh path can propagate.","Do not cache hotpatchable systems outside schedules; if you must, call refresh_hotpatch after each patch.","Keep a one-command full rebuild in your workflow for stale-pointer recovery."],"tags":["bevy","ecs","hotpatching","subsecond","function-pointer","exclusive-system"],"backgroundTag":"stale-pointer-after-hot-reload","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}