bevyengine/bevy · error

Error adding plugin {} in group {}: plugin was already added

Error message

Error adding plugin {} in group {}: plugin was already added in application

What it means

Panics during PluginGroupBuilder::finish when adding one of the group's enabled plugins to the App returns AppError::DuplicatePlugin: that plugin type was already added to the application earlier (directly or via another group). The group build is aborted at the first duplicate encountered.

Source

Thrown at crates/bevy_app/src/plugin_group.rs:576

    }

    /// Consumes the [`PluginGroupBuilder`] and [builds](Plugin::build) the contained [`Plugin`]s
    /// in the order specified.
    ///
    /// # Panics
    ///
    /// Panics if one of the plugin in the group was already added to the application.
    #[track_caller]
    pub fn finish(mut self, app: &mut App) {
        for ty in &self.order {
            if let Some(entry) = self.plugins.remove(ty)
                && entry.enabled
            {
                debug!("added plugin: {}", entry.plugin.name());
                if let Err(AppError::DuplicatePlugin { plugin_name }) =
                    app.add_boxed_plugin(entry.plugin)
                {
                    panic!(
                        "Error adding plugin {} in group {}: plugin was already added in application",
                        plugin_name,
                        self.group_name
                    );
                }
            }
        }
    }
}

/// A plugin group which doesn't do anything. Useful for examples:
/// ```
/// # use bevy_app::prelude::*;
/// use bevy_app::NoopPluginGroup as MinimalPlugins;
///
/// fn main(){
///     App::new().add_plugins(MinimalPlugins).run();
/// }

View on GitHub (pinned to 396ca72708)

Solutions

  1. Remove the earlier direct app.add_plugin call for plugin types that are also part of this PluginGroup
  2. Avoid adding overlapping PluginGroups that contain the same plugin type
  3. Disable the duplicate plugin in one of the groups (e.g. DefaultPlugins.disable::<T>()) instead of adding it twice
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/bevy_app/src/plugin_group.rs:576 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/3e84832906e72d1b. Report an issue: GitHub.