bevyengine/bevy · error

Requested config {} does not exist in `GizmoConfigStore`! Di

Error message

Requested config {} does not exist in `GizmoConfigStore`! Did you forget to add it using `app.init_gizmo_group<T>()`?

What it means

GizmoConfigStore::config::<T>() panics when no GizmoConfig/GizmoConfigGroup pair has been registered for the group type T. Each gizmo plugin (e.g. LightGizmoPlugin, AabbGizmoPlugin, or your own) registers its group via app.init_gizmo_group::<T>(); the store lookup by TypeId then succeeds. Requesting a group that was never initialized — the message even suggests the fix — aborts with this panic.

Source

Thrown at crates/bevy_gizmos/src/config.rs:122

impl GizmoConfigStore {
    /// Returns [`GizmoConfig`] and [`GizmoConfigGroup`] associated with [`TypeId`] of a [`GizmoConfigGroup`]
    pub fn get_config_dyn(&self, config_type_id: &TypeId) -> Option<(&GizmoConfig, &dyn Reflect)> {
        let (config, ext) = self.store.get(config_type_id)?;
        Some((config, ext.deref()))
    }

    /// Returns [`GizmoConfig`] and [`GizmoConfigGroup`] associated with [`GizmoConfigGroup`] `T`
    ///
    /// # Panics
    /// If the config does not exist for [`GizmoConfigGroup`] `T`
    ///
    /// For a non-panicking version, see [`get_config`].
    ///
    /// [`get_config`]: Self::get_config
    pub fn config<T: GizmoConfigGroup>(&self) -> (&GizmoConfig, &T) {
        let Some(configs) = self.get_config() else {
            panic!("Requested config {} does not exist in `GizmoConfigStore`! Did you forget to add it using `app.init_gizmo_group<T>()`?", T::type_path());
        };
        configs
    }

    /// Returns Some([`GizmoConfig`] and [`GizmoConfigGroup`] associated with [`GizmoConfigGroup`] `T` if they exist,
    /// else None.
    ///
    /// If the configs will always be present, use [`config`].
    ///
    /// [`config`]: Self::config
    pub fn get_config<T: GizmoConfigGroup>(&self) -> Option<(&GizmoConfig, &T)> {
        let (config, ext) = self.get_config_dyn(&TypeId::of::<T>())?;
        // hash map invariant guarantees that &dyn Reflect is of correct type T
        let ext = ext.as_any().downcast_ref().unwrap();
        Some((config, ext))
    }

    /// Returns mutable [`GizmoConfig`] and [`GizmoConfigGroup`] associated with [`TypeId`] of a [`GizmoConfigGroup`]

View on GitHub (pinned to 8d743eb7dc)

Solutions

  1. Register the group at startup: app.init_gizmo_group::<MyGroup>() (uses GizmoConfigGroup::default()).
  2. If the group belongs to a plugin (Light/Aabb/etc.), add that plugin — it registers its group itself.
  3. Use the non-panicking gizmo_config_store.get_config::<T>() (Option) when the group may be absent.
  4. Verify the exact group type parameter — a wrapper vs inner group type mix-up fails the TypeId lookup.

Example fix

// before
let (config, group) = store.config::<MyGizmos>(); // panics if never initialized

// after
app.init_gizmo_group::<MyGizmos>();
// ...
let (config, group) = store.config::<MyGizmos>();

// or optional:
if let Some((config, group)) = store.get_config::<MyGizmos>() { /* ... */ }
Defensive patterns

Strategy: validation

Validate before calling

if let Some((config, group)) = gizmo_store.get_config::<MyGroup>() {
    // safe: group registered
} else {
    app.init_gizmo_group::<MyGroup>();
}

Type guard

fn has_gizmo_group<T: GizmoConfigGroup>(store: &GizmoConfigStore) -> bool {
    store.get_config::<T>().is_some()
}

Prevention

When it happens

Trigger: Calling gizmo_config_store.config::<MyGroup>() where MyGroup: GizmoConfigGroup was never passed to app.init_gizmo_group::<MyGroup>(); accessing a plugin's config group (e.g. LightGizmoConfigGroup) without adding that gizmo plugin; querying the store in an app that never added any gizmo plugin.

Common situations: Custom gizmo groups for debugging overlays where the author forgot init_gizmo_group; conditional debug tooling that reads gizmo configs even when gizmo plugins were feature-gated out; version upgrades renaming or moving config groups between plugins.

Related errors


AI-assisted analysis of bevyengine/bevy@8d743eb7dc (2026-08-20). Data as JSON: /api/errors/15bd55159a781bcd. Report an issue: GitHub.