{"record":{"id":"550fd7f334733e80","repo":"bevyengine/bevy","slug":"expected-downcast-to-expected-but-received","errorCode":null,"errorMessage":"expected downcast to `{expected}`, but received `{received}`","messagePattern":"expected downcast to `(.+?)`, but received `(.+?)`","errorType":"exception","errorClass":"ReflectCloneError","httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/error.rs","lineNumber":54,"sourceCode":"    /// [deriving `Reflect`]: derive@crate::Reflect\n    #[error(\n        \"field `{}` cannot be made cloneable for `PartialReflect::reflect_clone` (are you missing a `#[reflect(clone)]` attribute?)\",\n        full_path(.field, .variant.as_deref(), .container_type_path)\n    )]\n    FieldNotCloneable {\n        /// Struct field or enum variant field which cannot be cloned.\n        field: FieldId,\n        /// Variant this field is part of if the container is an enum, otherwise [`None`].\n        variant: Option<Cow<'static, str>>,\n        /// Fully qualified path of the type containing this field.\n        container_type_path: Cow<'static, str>,\n    },\n    /// Could not downcast to the expected type.\n    ///\n    /// Realistically this should only occur when a type has incorrectly implemented [`Reflect`].\n    ///\n    /// [`Reflect`]: crate::Reflect\n    #[error(\"expected downcast to `{expected}`, but received `{received}`\")]\n    FailedDowncast {\n        /// The fully qualified path of the type that was expected.\n        expected: Cow<'static, str>,\n        /// The fully qualified path of the type that was received.\n        received: Cow<'static, str>,\n    },\n}\n\nfn full_path(\n    field: &FieldId,\n    variant: Option<&str>,\n    container_type_path: &str,\n) -> alloc::string::String {\n    match variant {\n        Some(variant) => format!(\"{container_type_path}::{variant}::{field}\"),\n        None => format!(\"{container_type_path}::{field}\"),\n    }\n}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/src/error.rs#L36-L72","documentation":"ReflectCloneError::FieldNotCloneable — while cloning a reflected container, a specific field (identified by FieldId, optional variant name, and container type path) could not be cloned, typically because it lacks a #[reflect(clone)] attribute. Add the attribute or a clone registration for that field's type.","triggerScenarios":"Thrown at crates/bevy_reflect/src/error.rs:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Downcast to the actual received type instead","Check represents::<T>() or reflect_type_path() before downcasting","Fix registration so the expected and actual types agree"],"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-14T00:17:10.932Z"}