{"record":{"id":"f342cf94ba4c6c10","repo":"bevyengine/bevy","slug":"cannot-disable-a-plugin-that-does-not-exist","errorCode":null,"errorMessage":"Cannot disable a plugin that does not exist.","messagePattern":"Cannot disable a plugin that does not exist\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_app/src/plugin_group.rs","lineNumber":555,"sourceCode":"    pub fn enable<T: Plugin>(mut self) -> Self {\n        let plugin_entry = self\n            .plugins\n            .get_mut(&TypeId::of::<T>())\n            .expect(\"Cannot enable a plugin that does not exist.\");\n        plugin_entry.enabled = true;\n        self\n    }\n\n    /// Disables a [`Plugin`], preventing it from being added to the [`App`] with the rest of the\n    /// [`PluginGroup`]. The disabled [`Plugin`] keeps its place in the [`PluginGroup`], so it can\n    /// still be used for ordering with [`add_before`](Self::add_before) or\n    /// [`add_after`](Self::add_after), or it can be [re-enabled](Self::enable). If there are no\n    /// plugins of type `T` in this group, it will panic.\n    pub fn disable<T: Plugin>(mut self) -> Self {\n        let plugin_entry = self\n            .plugins\n            .get_mut(&TypeId::of::<T>())\n            .expect(\"Cannot disable a plugin that does not exist.\");\n        plugin_entry.enabled = false;\n        self\n    }\n\n    /// Consumes the [`PluginGroupBuilder`] and [builds](Plugin::build) the contained [`Plugin`]s\n    /// in the order specified.\n    ///\n    /// # Panics\n    ///\n    /// Panics if one of the plugin in the group was already added to the application.\n    #[track_caller]\n    pub fn finish(mut self, app: &mut App) {\n        for ty in &self.order {\n            if let Some(entry) = self.plugins.remove(ty)\n                && entry.enabled\n            {\n                debug!(\"added plugin: {}\", entry.plugin.name());\n                if let Err(AppError::DuplicatePlugin { plugin_name }) =","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_app/src/plugin_group.rs#L537-L573","documentation":"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.","triggerScenarios":"Thrown at crates/bevy_app/src/plugin_group.rs:555 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call disable::<T>() only on plugin types that exist in this PluginGroupBuilder","Verify the plugin was not removed from the group (e.g. via a custom group definition)","If absence is expected, check membership or use a builder variant that tolerates missing plugins"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}