{"record":{"id":"964e2aadb8383b5b","repo":"bevyengine/bevy","slug":"attempted-to-apply-a-non-array-type-to-an-array","errorCode":null,"errorMessage":"Attempted to apply a non-`Array` type to an `Array` type.","messagePattern":"Attempted to apply a non-`Array` type to an `Array` type\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/array.rs","lineNumber":421,"sourceCode":"\n/// Applies the reflected [array](Array) data to the given [array](Array).\n///\n/// # Panics\n///\n/// * Panics if the two arrays have differing lengths.\n/// * Panics if the reflected value is not a [valid array](ReflectRef::Array).\n#[inline]\npub fn array_apply<A: Array + ?Sized>(array: &mut A, reflect: &dyn PartialReflect) {\n    if let ReflectRef::Array(reflect_array) = reflect.reflect_ref() {\n        if array.len() != reflect_array.len() {\n            panic!(\"Attempted to apply different sized `Array` types.\");\n        }\n        for (i, value) in reflect_array.iter().enumerate() {\n            let v = array.get_mut(i).unwrap();\n            v.apply(value);\n        }\n    } else {\n        panic!(\"Attempted to apply a non-`Array` type to an `Array` type.\");\n    }\n}\n\n/// Tries to apply the reflected [array](Array) data to the given [array](Array) and\n/// returns a Result.\n///\n/// # Errors\n///\n/// * Returns an [`ApplyError::DifferentSize`] if the two arrays have differing lengths.\n/// * Returns an [`ApplyError::MismatchedKinds`] if the reflected value is not a\n///   [valid array](ReflectRef::Array).\n/// * Returns any error that is generated while applying elements to each other.\n#[inline]\npub fn array_try_apply<A: Array>(\n    array: &mut A,\n    reflect: &dyn PartialReflect,\n) -> Result<(), ApplyError> {\n    let reflect_array = reflect.reflect_ref().as_array()?;","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_reflect/src/array.rs#L403-L439","documentation":"Panic in array_apply (used by PartialReflect::apply for arrays): the value being applied is not a reflected array (its ReflectRef is not ReflectRef::Array). Only reflected array values may be applied to an array.","triggerScenarios":"Thrown at crates/bevy_reflect/src/array.rs:419 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a value that reflects as an Array","Use try_apply to receive a MismatchedKinds error instead of panicking","Check reflect_ref() kind before applying"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}