{"record":{"id":"8aff6467c71b3341","repo":"bevyengine/bevy","slug":"attempted-to-call-typeregistry-register-type-dat-8aff64","errorCode":null,"errorMessage":"attempted to call `TypeRegistry::register_type_data_with` for type `{T}` with data `{D}` and params `{P}` without registering `{T}` first","messagePattern":"attempted to call `TypeRegistry::register_type_data_with` for type `(.+?)` with data `(.+?)` and params `(.+?)` without registering `(.+?)` first","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/type_registry.rs","lineNumber":369,"sourceCode":"        });\n        data.insert(D::create_type_data(()));\n    }\n\n    /// Registers the type data `D` with parameter `P` for type `T`.\n    ///\n    /// Most of the time [`TypeRegistry::register`] can be used instead to register a type you derived [`Reflect`] for.\n    /// 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,\n    /// or where the type is generic and cannot register the type data unconditionally without knowing the specific type parameters,\n    /// this method can be used to insert additional type data.\n    ///\n    /// If no parameters are needed for the type data or the type data does not accept parameters,\n    /// then [`TypeRegistry::register_type_data`] may be used instead.\n    pub fn register_type_data_with<T: Reflect + TypePath, D: CreateTypeData<T, P>, P>(\n        &mut self,\n        params: P,\n    ) {\n        let data = self.get_mut(TypeId::of::<T>()).unwrap_or_else(|| {\n            panic!(\n                \"attempted to call `TypeRegistry::register_type_data_with` for type `{T}` with data `{D}` and params `{P}` without registering `{T}` first\",\n                T = T::type_path(),\n                D = ::core::any::type_name::<D>(),\n                P = ::core::any::type_name::<P>(),\n            )\n        });\n        data.insert(D::create_type_data(params));\n    }\n\n    /// Registers a fallible conversion from type T to U with the reflection\n    /// system.\n    ///\n    /// The supplied closure is expected to produce a value of type U, given an\n    /// instance of type T. If the conversion fails, the closure should return\n    /// the input value, wrapped in an `Err` variant.\n    ///\n    /// # Example\n    /// ```","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/src/type_registry.rs#L351-L387","documentation":"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.","triggerScenarios":"Thrown at crates/bevy_reflect/src/type_registry.rs:369 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call registry.register::<T>() before register_type_data_with::<T, D, P>()"],"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"}