{"record":{"id":"119f62376d28d42b","repo":"bevyengine/bevy","slug":"fromreflect-from-reflect-failed-when-called-on-ty","errorCode":null,"errorMessage":"FromReflect::from_reflect failed when called on type `{}` with this value: {value:?}","messagePattern":"FromReflect::from_reflect failed when called on type `(.+?)` with this value: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/type_registry.rs","lineNumber":854,"sourceCode":"/// A struct used to serialize reflected instances of a type.\n///\n/// A `ReflectSerialize` for type `T` can be obtained via\n/// [`CreateTypeData::create_type_data`].\n#[derive(Clone)]\npub struct ReflectSerialize {\n    get_serializable: fn(value: &dyn Reflect) -> Serializable,\n}\n\nimpl<T: TypePath + FromReflect + erased_serde::Serialize> CreateTypeData<T> for ReflectSerialize {\n    fn create_type_data(_input: ()) -> Self {\n        ReflectSerialize {\n            get_serializable: |value| {\n                value\n                    .downcast_ref::<T>()\n                    .map(|value| Serializable::Borrowed(value))\n                    .or_else(|| T::from_reflect(value.as_partial_reflect()).map(|value| Serializable::Owned(Box::new(value))))\n                    .unwrap_or_else(|| {\n                        panic!(\n                            \"FromReflect::from_reflect failed when called on type `{}` with this value: {value:?}\",\n                            T::type_path(),\n                        );\n                    })\n            },\n        }\n    }\n}\n\nimpl ReflectSerialize {\n    /// Turn the value into a serializable representation\n    pub fn get_serializable<'a>(&self, value: &'a dyn Reflect) -> Serializable<'a> {\n        (self.get_serializable)(value)\n    }\n\n    /// Serializes a reflected value.\n    pub fn serialize<S>(&self, value: &dyn Reflect, serializer: S) -> Result<S::Ok, S::Error>\n    where","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/src/type_registry.rs#L836-L872","documentation":"Panic inside the ReflectSerialize/FromReflect type-data closure: downcasting a value to the registered type T failed during serialization-related FromReflect conversion, so the value's actual type differs from the registered one.","triggerScenarios":"Thrown at crates/bevy_reflect/src/type_registry.rs:854 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure values passed match the registered type","Fix type registration so the same type is registered and used"],"exampleFix":null,"handlingStrategy":"type-guard","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"}