bevyengine/bevy · error

Cannot disable a plugin that does not exist.

Error message

Cannot disable a plugin that does not exist.

What it means

Panics in PluginGroupBuilder::disable because the plugins map has no entry for TypeId::of::<T>(): the group contains no plugin of type T whose enabled flag could be cleared. Disabling only changes state of plugins already present in the group.

Source

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

    pub fn enable<T: Plugin>(mut self) -> Self {
        let plugin_entry = self
            .plugins
            .get_mut(&TypeId::of::<T>())
            .expect("Cannot enable a plugin that does not exist.");
        plugin_entry.enabled = true;
        self
    }

    /// Disables a [`Plugin`], preventing it from being added to the [`App`] with the rest of the
    /// [`PluginGroup`]. The disabled [`Plugin`] keeps its place in the [`PluginGroup`], so it can
    /// still be used for ordering with [`add_before`](Self::add_before) or
    /// [`add_after`](Self::add_after), or it can be [re-enabled](Self::enable). If there are no
    /// plugins of type `T` in this group, it will panic.
    pub fn disable<T: Plugin>(mut self) -> Self {
        let plugin_entry = self
            .plugins
            .get_mut(&TypeId::of::<T>())
            .expect("Cannot disable a plugin that does not exist.");
        plugin_entry.enabled = false;
        self
    }

    /// 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 }) =

View on GitHub (pinned to 396ca72708)

Solutions

  1. Call disable::<T>() only on plugin types that exist in this PluginGroupBuilder
  2. Verify the plugin was not removed from the group (e.g. via a custom group definition)
  3. If absence is expected, check membership or use a builder variant that tolerates missing plugins
Defensive patterns

Strategy: validation

When it happens

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