bevyengine/bevy · error

{} does not exist in this PluginGroup

Error message

{} does not exist in this PluginGroup

What it means

Panics in PluginGroupBuilder::set when try_set fails because no plugin of type T exists in the group being built. The builder cannot replace the configuration of a plugin it does not contain; the type must have been added to the group first.

Source

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

                .order
                .iter()
                .enumerate()
                .find(|(i, ty)| *i != added_at_index && **ty == key)
                .map(|(i, _)| i)
            {
                self.order.remove(to_remove);
            }
        }
    }

    /// Sets the value of the given [`Plugin`], if it exists.
    ///
    /// # Panics
    ///
    /// Panics if the [`Plugin`] does not exist.
    pub fn set<T: Plugin>(self, plugin: T) -> Self {
        self.try_set(plugin).unwrap_or_else(|_| {
            panic!(
                "{} does not exist in this PluginGroup",
                core::any::type_name::<T>(),
            )
        })
    }

    /// Tries to set the value of the given [`Plugin`], if it exists.
    ///
    /// If the given plugin doesn't exist returns self and the passed in [`Plugin`].
    pub fn try_set<T: Plugin>(mut self, plugin: T) -> Result<Self, (Self, T)> {
        match self.plugins.entry(TypeId::of::<T>()) {
            Entry::Occupied(mut entry) => {
                entry.get_mut().plugin = Box::new(plugin);

                Ok(self)
            }
            Entry::Vacant(_) => Err((self, plugin)),
        }

View on GitHub (pinned to 396ca72708)

Solutions

  1. Add the plugin to the PluginGroup (via add/add_before/add_after) before calling set on it
  2. Check that you are calling set on the correct PluginGroupBuilder instance
  3. If the plugin may legitimately be absent, use try_set and handle the Err case instead of set
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/bevy_app/src/plugin_group.rs:364 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/037ee2db2c06b20a. Report an issue: GitHub.