bevyengine/bevy · error · ApplyError
variant with name `{variant_name}` does not exist on enum `{
Error message
variant with name `{variant_name}` does not exist on enum `{enum_name}` What it means
ApplyError::MissingVariant — try_apply on enums found the source's variant name does not exist on the destination enum type. Payloads: variant_name and enum_name. Apply values whose variant is defined on the target enum (or use patching with dynamic enums).
Source
Thrown at crates/bevy_reflect/src/reflect.rs:61
MismatchedTypes {
/// Type of the value we attempted to apply.
from_type: Box<str>,
/// Type we attempted to apply the value to.
to_type: Box<str>,
},
#[error("attempted to apply type with {from_size} size to a type with {to_size} size")]
/// Attempted to apply an [array-like] type to another of different size, e.g. a [u8; 4] to [u8; 3].
///
/// [array-like]: crate::array::Array
DifferentSize {
/// Size of the value we attempted to apply, in elements.
from_size: usize,
/// Size of the type we attempted to apply the value to, in elements.
to_size: usize,
},
#[error("variant with name `{variant_name}` does not exist on enum `{enum_name}`")]
/// The enum we tried to apply to didn't contain a variant with the give name.
UnknownVariant {
/// Name of the enum.
enum_name: Box<str>,
/// Name of the missing variant.
variant_name: Box<str>,
},
#[error(transparent)]
/// A value could not be converted to its dynamic representation via
/// [`PartialReflect::to_dynamic`] while applying it.
CloneError(#[from] ReflectCloneError),
}
impl From<ReflectKindMismatchError> for ApplyError {
fn from(value: ReflectKindMismatchError) -> Self {
Self::MismatchedKinds {
from_kind: value.received,View on GitHub (pinned to 396ca72708)
Solutions
- Use a variant name that exists on the enum
- Add the missing variant to the enum definition
- Fix typos in the variant name
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_reflect/src/reflect.rs:61 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/dbf60d03a248b618.
Report an issue: GitHub.