{"record":{"id":"bb9c323e7579a92a","repo":"bevyengine/bevy","slug":"expected-bundle-to-be-a-named-struct-or-tuple","errorCode":null,"errorMessage":"expected bundle `{}` to be a named struct or tuple","messagePattern":"expected bundle `(.+?)` to be a named struct or tuple","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/reflect/bundle.rs","lineNumber":218,"sourceCode":"                                apply_or_insert_field_mapped(\n                                    entity,\n                                    field,\n                                    registry,\n                                    mapper,\n                                    relationship_hook_mode,\n                                );\n                            });\n                        }\n                        ReflectRef::Tuple(bundle) => bundle.iter_fields().for_each(|field| {\n                            apply_or_insert_field_mapped(\n                                entity,\n                                field,\n                                registry,\n                                mapper,\n                                relationship_hook_mode,\n                            );\n                        }),\n                        _ => panic!(\n                            \"expected bundle `{}` to be a named struct or tuple\",\n                            // FIXME: once we have unique reflect, use `TypePath`.\n                            DebugName::type_name::<B>(),\n                        ),\n                    }\n                }\n            },\n            remove: |entity| {\n                entity.remove::<B>();\n            },\n            take: |entity| {\n                entity\n                    .take::<B>()\n                    .map(|bundle| Box::new(bundle).into_reflect())\n            },\n        })\n    }\n}","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/reflect/bundle.rs#L200-L236","documentation":"Panic in ReflectBundleFns::apply: the reflected bundle value being applied is not represented as a named struct or tuple, so the apply loop over its fields has no supported layout to read. Distinct from the insert-time variant: this fires while applying to an entity that already has components.","triggerScenarios":"Thrown at crates/bevy_ecs/src/reflect/bundle.rs:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Apply a reflected value created from the same bundle type (Struct/Tuple representation)","Convert dynamic reflect data through ReflectDefault/from_reflect into the bundle type first","Validate reflected_bundle.reflect_ref() shape before calling apply"],"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"}