bevyengine/bevy · error
Error adding plugin {plugin_name}: : plugin was already adde
Error message
Error adding plugin {plugin_name}: : plugin was already added in application What it means
Panics in the Plugins::add_to_app implementation for a single Plugin when App::add_boxed_plugin returns AppError::DuplicatePlugin: the exact plugin type has already been added to this App before. Bevy refuses to add the same plugin type twice to keep build logic idempotent.
Source
Thrown at crates/bevy_app/src/plugin.rs:150
use variadics_please::all_tuples;
use crate::{App, AppError, Plugin, PluginGroup};
pub trait Plugins<Marker> {
fn add_to_app(self, app: &mut App);
}
pub struct PluginMarker;
pub struct PluginGroupMarker;
pub struct PluginsTupleMarker;
impl<P: Plugin> Plugins<PluginMarker> for P {
#[track_caller]
fn add_to_app(self, app: &mut App) {
if let Err(AppError::DuplicatePlugin { plugin_name }) =
app.add_boxed_plugin(Box::new(self))
{
panic!(
"Error adding plugin {plugin_name}: : plugin was already added in application"
)
}
}
}
impl<P: PluginGroup> Plugins<PluginGroupMarker> for P {
#[track_caller]
fn add_to_app(self, app: &mut App) {
self.build().finish(app);
}
}
macro_rules! impl_plugins_tuples {
($(#[$meta:meta])* $(($param: ident, $plugins: ident)),*) => {
$(#[$meta])*
impl<$($param, $plugins),*> Plugins<(PluginsTupleMarker, $($param,)*)> for ($($plugins,)*)
whereView on GitHub (pinned to 396ca72708)
Solutions
- Remove the duplicate app.add_plugin(...) / app.add_plugins(...) call for the same plugin type
- Check whether the plugin is already included via a PluginGroup (e.g. DefaultPlugins) before adding it manually
- If conditional, guard the addition with a check of the plugin registry or use feature gates to avoid double registration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_app/src/plugin.rs:150 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/aeb31434e613b37b.
Report an issue: GitHub.