bevyengine/bevy · error
expected bundle `{}` to be named struct or tuple
Error message
expected bundle `{}` to be named struct or tuple What it means
Panic in ReflectBundleFns::from_reflect (insert path): dynamic reflection produced a bundle value whose ReflectRef shape is neither Struct nor Tuple (e.g. a Map/List or a unit), so its fields cannot be applied field-wise onto the entity. The message names the offending bundle type.
Source
Thrown at crates/bevy_ecs/src/reflect/bundle.rs:173
let bundle = entity.world_scope(|world| {
from_reflect_with_fallback::<B>(reflected_bundle, world, registry)
});
entity.insert(bundle);
},
apply: |mut entity, reflected_bundle, registry| {
if let Some(reflect_component) =
registry.get_type_data::<ReflectComponent>(TypeId::of::<B>())
{
reflect_component.apply(entity, reflected_bundle);
} else {
match reflected_bundle.reflect_ref() {
ReflectRef::Struct(bundle) => bundle
.iter_fields()
.for_each(|(_, field)| apply_field(&mut entity, field, registry)),
ReflectRef::Tuple(bundle) => bundle
.iter_fields()
.for_each(|field| apply_field(&mut entity, field, registry)),
_ => panic!(
"expected bundle `{}` to be named struct or tuple",
// FIXME: once we have unique reflect, use `TypePath`.
DebugName::type_name::<B>(),
),
}
}
},
apply_or_insert_mapped: |entity,
reflected_bundle,
registry,
mapper,
relationship_hook_mode| {
if let Some(reflect_component) =
registry.get_type_data::<ReflectComponent>(TypeId::of::<B>())
{
reflect_component.apply_or_insert_mapped(
entity,
reflected_bundle,View on GitHub (pinned to 396ca72708)
Solutions
- Ensure the reflected data deserializes into the bundle's Struct/Tuple shape (e.g. via ReflectDeserializer to the bundle type)
- Register and construct the bundle type itself rather than a dynamic proxy
- Handle the dynamic value with from_reflect_with_fallback on the concrete bundle type
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/bevy_ecs/src/reflect/bundle.rs:173 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/b2d911d6b6b5c3d5.
Report an issue: GitHub.