{"record":{"id":"65dc3fb7d8470897","repo":"bevyengine/bevy","slug":"attempted-to-call-typeregistry-register-type-dat","errorCode":null,"errorMessage":"attempted to call `TypeRegistry::register_type_data` for type `{T}` with data `{D}` without registering `{T}` first","messagePattern":"attempted to call `TypeRegistry::register_type_data` for type `(.+?)` with data `(.+?)` without registering `(.+?)` first","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/type_registry.rs","lineNumber":346,"sourceCode":"    /// Registers the type data `D` 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    /// # Example\n    /// ```\n    /// use bevy_reflect::{TypeRegistry, ReflectSerialize, ReflectDeserialize};\n    ///\n    /// let mut type_registry = TypeRegistry::default();\n    /// type_registry.register::<Option<String>>();\n    /// type_registry.register_type_data::<Option<String>, ReflectSerialize>();\n    /// type_registry.register_type_data::<Option<String>, ReflectDeserialize>();\n    /// ```\n    pub fn register_type_data<T: Reflect + TypePath, D: CreateTypeData<T>>(&mut self) {\n        let data = self.get_mut(TypeId::of::<T>()).unwrap_or_else(|| {\n            panic!(\n                \"attempted to call `TypeRegistry::register_type_data` for type `{T}` with data `{D}` without registering `{T}` first\",\n                T = T::type_path(),\n                D = core::any::type_name::<D>(),\n            )\n        });\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>(","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/src/type_registry.rs#L328-L364","documentation":"Panic in TypeRegistry::register_type_data: type T (the data's target) was not registered in the registry before adding type data D for it. Call register::<T>() (or register_type_data with the derive-included data) before adding extra type data.","triggerScenarios":"Thrown at crates/bevy_reflect/src/type_registry.rs:346 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call registry.register::<T>() before register_type_data::<T, D>()"],"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-14T00:17:10.932Z"}