bevyengine/bevy · error
Joining queries initialized on different worlds is not allow
Error message
Joining queries initialized on different worlds is not allowed.
What it means
Panic from QueryState::join_filtered: the two QueryStates being joined were created against different Worlds (their world_id fields differ). A joined query's tables/archetypes are only valid relative to one world, so this guard rejects cross-world joins as unsound.
Source
Thrown at crates/bevy_ecs/src/query/state.rs:813
/// Use this to combine two queries. The data accessed will be the intersection
/// of archetypes included in both queries.
///
/// ## Panics
///
/// Will panic if `NewD` or `NewF` requires accesses not in `Q` or `OtherQ`.
pub fn join_filtered<
'a,
OtherD: QueryData,
OtherF: QueryFilter,
NewD: SingleEntityQueryData,
NewF: QueryFilter,
>(
&self,
world: impl Into<UnsafeWorldCell<'a>>,
other: &QueryState<OtherD, OtherF>,
) -> QueryState<NewD, NewF> {
if self.world_id != other.world_id {
panic!("Joining queries initialized on different worlds is not allowed.");
}
let world = world.into();
self.validate_world(world.id());
let mut component_access = FilteredAccess::default();
let mut new_fetch_state = NewD::get_state(world.components())
.expect("Could not create fetch_state, Please initialize all referenced components before transmuting.");
let new_filter_state = NewF::get_state(world.components())
.expect("Could not create filter_state, Please initialize all referenced components before transmuting.");
let mut joined_component_access = self.component_access.clone();
joined_component_access.extend(&other.component_access);
if D::IS_READ_ONLY && self.component_access.access().has_any_write()
|| OtherD::IS_READ_ONLY && other.component_access.access().has_any_write()
{View on GitHub (pinned to 396ca72708)
Solutions
- Recreate one of the QueryStates against the same World before joining
- Initialize both states from the target world (e.g. world.query::<Q>())
- Avoid persisting QueryState across world instances
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_ecs/src/query/state.rs:813 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/3b1d6646b66aabed.
Report an issue: GitHub.