{"record":{"id":"d55653f8929f6eb9","repo":"bevyengine/bevy","slug":"the-world-s-typeregistry-did-not-contain-type","errorCode":null,"errorMessage":"The `World`'s `TypeRegistry` did not contain `TypeData` for `ReflectFromPtr` for the given {0:?} (did you call `App::register_type()`?)","messagePattern":"The `World`'s `TypeRegistry` did not contain `TypeData` for `ReflectFromPtr` for the given (.+?) \\(did you call `App::register_type\\(\\)`\\?\\)","errorType":"exception","errorClass":"GetComponentReflectError::MissingReflectFromPtrTypeData","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/world/reflect.rs","lineNumber":253,"sourceCode":"        component_name: Option<DebugName>,\n    },\n\n    /// The [`World`] was missing the [`AppTypeRegistry`] resource.\n    #[error(\"The `World` was missing the `AppTypeRegistry` resource\")]\n    MissingAppTypeRegistry,\n\n    /// The [`World`]'s [`TypeRegistry`] did not contain [`TypeData`] for [`ReflectFromPtr`] for the given [`TypeId`].\n    ///\n    /// This is usually handled by calling [`App::register_type`] for the type corresponding to\n    /// the given [`TypeId`].\n    ///\n    /// See the documentation for [`bevy_reflect`] for more information.\n    ///\n    /// [`TypeData`]: bevy_reflect::TypeData\n    /// [`TypeRegistry`]: bevy_reflect::TypeRegistry\n    /// [`ReflectFromPtr`]: bevy_reflect::ReflectFromPtr\n    /// [`App::register_type`]: ../../../bevy_app/struct.App.html#method.register_type\n    #[error(\"The `World`'s `TypeRegistry` did not contain `TypeData` for `ReflectFromPtr` for the given {0:?} (did you call `App::register_type()`?)\")]\n    MissingReflectFromPtrTypeData(TypeId),\n}\n\n#[cfg(test)]\nmod tests {\n    use core::any::TypeId;\n\n    use bevy_reflect::Reflect;\n\n    use crate::prelude::{AppTypeRegistry, Component, DetectChanges, World};\n\n    #[derive(Component, Reflect)]\n    struct RFoo(i32);\n\n    #[derive(Component)]\n    struct Bar;\n\n    #[test]","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/world/reflect.rs#L235-L271","documentation":"GetComponentReflectError::MissingReflectFromPtrTypeData is returned by World::get_reflect / get_reflect_mut when the type IS present in the TypeRegistry but lacks the ReflectFromPtr type data needed to convert a raw component pointer into a &dyn Reflect. ReflectFromPtr is attached automatically by #[derive(Reflect)], so its absence means the type got into the registry through a partial/manual registration (or a non-Reflect proxy) rather than a full register_type call.","triggerScenarios":"world.get_reflect(entity, TypeId::of::<T>()) where T was registered manually via registry.register_type_data or wrapped without deriving Reflect; types registered only as primitives/opaque; a version mix where an old serialized TypeId maps to a type registered differently; reflecting a type registered through ReflectDefault-only paths.","commonSituations":"Custom registration code that adds TypeData piecemeal instead of deriving Reflect and calling app.register_type; hot-reload/editor pipelines registering placeholder types; third-party components with hand-written Reflect impls missing FromReflect/ReflectFromPtr.","solutions":["Derive Reflect on the component (#[derive(Component, Reflect)]) and register with app.register_type::<T>() so ReflectFromPtr is generated.","If you cannot derive, implement/attach the data explicitly: registry.get_mut(type_id).unwrap().insert(<ReflectFromPtr as FromReflect>::from_reflect(...)) or use bevy_reflect's registration helpers.","Pre-check before access: app_type_registry.read().get_type_data::<ReflectFromPtr>(TypeId::of::<T>()).is_some() and skip with a clear log.","After upgrading Bevy or swapping reflect crates, wipe stale registry state and re-register all reflected types."],"exampleFix":"// before\n#[derive(Component)] struct Health(f32); // no Reflect derive\nregistry.write().register::<Health>(); // partial registration\nlet c = world.get_reflect(e, TypeId::of::<Health>())?; // MissingReflectFromPtrTypeData\n\n// after\n#[derive(Component, Reflect)] struct Health(f32);\napp.register_type::<Health>();\nlet c = world.get_reflect(e, TypeId::of::<Health>())?;","handlingStrategy":"validation","validationCode":"let registry = world.resource::<AppTypeRegistry>().0.clone();\nlet has_from_ptr = registry\n    .read()\n    .get_type_data::<ReflectFromPtr>(TypeId::of::<T>())\n    .is_some();\nif !has_from_ptr {\n    registry.write().register::<T>(); // full registration attaches ReflectFromPtr\n}","typeGuard":null,"tryCatchPattern":"match world.get_reflect(entity, TypeId::of::<T>()) {\n    Err(GetComponentReflectError::MissingReflectFromPtrTypeData(id)) => {\n        debug!(\"type {id:?} registered without ReflectFromPtr; re-register with #[derive(Reflect)]\");\n    }\n    other => { /* ... */ }\n}","preventionTips":["Derive Reflect rather than hand-rolled partial registration for reflected components.","After Bevy upgrades, re-register all reflected types to refresh TypeData.","Probe get_type_data::<ReflectFromPtr> before low-level reflective pointer work."],"tags":["bevy","ecs","reflect","reflect-from-ptr","type-registry","register-type"],"backgroundTag":"type-not-registered","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"}