bevyengine/bevy · error

SubApp::update() was called while a plugin was building.

Error message

SubApp::update() was called while a plugin was building.

What it means

Panics in SubApp::run_default_schedule (reached via SubApp::update) when the sub-app still has a plugin in the middle of building. Running the default schedule while plugin build code is executing would observe a half-initialized app, so the call is rejected until plugin building completes.

Source

Thrown at crates/bevy_app/src/sub_app.rs:147

        core::mem::swap(self, &mut app.sub_apps.main);
    }

    /// Returns a reference to the [`World`].
    pub fn world(&self) -> &World {
        &self.world
    }

    /// Returns a mutable reference to the [`World`].
    pub fn world_mut(&mut self) -> &mut World {
        &mut self.world
    }

    /// Runs the default schedule.
    ///
    /// Does not clear internal trackers used for change detection.
    pub fn run_default_schedule(&mut self) {
        if self.is_building_plugins() {
            panic!("SubApp::update() was called while a plugin was building.");
        }

        if let Some(label) = self.update_schedule {
            self.world.run_schedule(label);
        }
    }

    /// Runs the default schedule and updates internal component trackers.
    pub fn update(&mut self) {
        self.run_default_schedule();
        self.world.clear_trackers();
    }

    /// Extracts data from `world` into the app's world using the registered extract method.
    ///
    /// **Note:** There is no default extract method. Calling `extract` does nothing if
    /// [`set_extract`](Self::set_extract) has not been called.
    pub fn extract(&mut self, world: &mut World) {

View on GitHub (pinned to 396ca72708)

Solutions

  1. Do not call App::update()/SubApp::update() from within a plugin's build method or while app.building_plugin is active
  2. Move the update call to after app initialization finishes (e.g. after App::new() ... and the runner takes over)
  3. If driving updates manually, ensure they happen outside of any plugin build closure
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/bevy_app/src/sub_app.rs:147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/60fb228f91df8995. Report an issue: GitHub.