{"record":{"id":"bd9c911b2f4836fe","repo":"bevyengine/bevy","slug":"enum-variant-variant-name-doesn-t-have-a-field","errorCode":null,"errorMessage":"enum variant `{variant_name}` doesn't have a field named `{field_name}`","messagePattern":"enum variant `(.+?)` doesn't have a field named `(.+?)`","errorType":"exception","errorClass":"ApplyError","httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/reflect.rs","lineNumber":32,"sourceCode":"};\n\nuse thiserror::Error;\n\nuse crate::utility::NonGenericTypeInfoCell;\n\n/// A enumeration of all error outcomes that might happen when running [`try_apply`](PartialReflect::try_apply).\n#[derive(Error, Debug)]\npub enum ApplyError {\n    #[error(\"attempted to apply `{from_kind}` to `{to_kind}`\")]\n    /// Attempted to apply the wrong [kind](ReflectKind) to a type, e.g. a struct to an enum.\n    MismatchedKinds {\n        /// Kind of the value we attempted to apply.\n        from_kind: ReflectKind,\n        /// Kind of the type we attempted to apply the value to.\n        to_kind: ReflectKind,\n    },\n\n    #[error(\"enum variant `{variant_name}` doesn't have a field named `{field_name}`\")]\n    /// Enum variant that we tried to apply to was missing a field.\n    MissingEnumField {\n        /// Name of the enum variant.\n        variant_name: Box<str>,\n        /// Name of the missing field.\n        field_name: Box<str>,\n    },\n\n    #[error(\"`{from_type}` is not `{to_type}`\")]\n    /// Tried to apply incompatible types.\n    MismatchedTypes {\n        /// Type of the value we attempted to apply.\n        from_type: Box<str>,\n        /// Type we attempted to apply the value to.\n        to_type: Box<str>,\n    },\n\n    #[error(\"attempted to apply type with {from_size} size to a type with {to_size} size\")]","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/src/reflect.rs#L14-L50","documentation":"ApplyError::MissingEnumField — try_apply targeted an enum variant that lacks a field present in the source value (fields are applied by name). Payloads: variant_name and field_name. Use variants with matching field sets or patch fields individually.","triggerScenarios":"Thrown at crates/bevy_reflect/src/reflect.rs:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the variant/field names in the source data","Add the missing field to the enum variant definition"],"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"}