bevyengine/bevy · error
attempted to call `TypeRegistry::register_type_data_with` fo
Error message
attempted to call `TypeRegistry::register_type_data_with` for type `{T}` with data `{D}` and params `{P}` without registering `{T}` first What it means
Panic in TypeRegistry::register_type_data_with: same precondition as register_type_data — type T must already be registered before attaching parameterized type data D built with params P. Register T first.
Source
Thrown at crates/bevy_reflect/src/type_registry.rs:369
});
data.insert(D::create_type_data(()));
}
/// Registers the type data `D` with parameter `P` for type `T`.
///
/// Most of the time [`TypeRegistry::register`] can be used instead to register a type you derived [`Reflect`] for.
/// However, in cases where you want to add a piece of type data that was not included in the list of `#[reflect(...)]` type data in the derive,
/// or where the type is generic and cannot register the type data unconditionally without knowing the specific type parameters,
/// this method can be used to insert additional type data.
///
/// If no parameters are needed for the type data or the type data does not accept parameters,
/// then [`TypeRegistry::register_type_data`] may be used instead.
pub fn register_type_data_with<T: Reflect + TypePath, D: CreateTypeData<T, P>, P>(
&mut self,
params: P,
) {
let data = self.get_mut(TypeId::of::<T>()).unwrap_or_else(|| {
panic!(
"attempted to call `TypeRegistry::register_type_data_with` for type `{T}` with data `{D}` and params `{P}` without registering `{T}` first",
T = T::type_path(),
D = ::core::any::type_name::<D>(),
P = ::core::any::type_name::<P>(),
)
});
data.insert(D::create_type_data(params));
}
/// Registers a fallible conversion from type T to U with the reflection
/// system.
///
/// The supplied closure is expected to produce a value of type U, given an
/// instance of type T. If the conversion fails, the closure should return
/// the input value, wrapped in an `Err` variant.
///
/// # Example
/// ```View on GitHub (pinned to 396ca72708)
Solutions
- Call registry.register::<T>() before register_type_data_with::<T, D, P>()
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_reflect/src/type_registry.rs:369 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/8aff6467c71b3341.
Report an issue: GitHub.