bevyengine/bevy · error
Entity {} {}
Error message
Entity {} {} What it means
Generic panic helper (panic_despawned) on EntityWorldMut: the entity has already been despawned, so further use of this handle is invalid. Callers like assert_not_despawned, location, and archetype forward their own context into this message.
Source
Thrown at crates/bevy_ecs/src/world/entity_access/world_mut.rs:65
/// You can check this via [`is_despawned`](Self::is_despawned).
/// Using an [`EntityWorldMut`] of a despawned entity may panic in some contexts, so read method documentation carefully.
///
/// Unless you have strong reason to assume these invariants, you should generally avoid keeping an [`EntityWorldMut`] to an entity that is potentially not spawned.
/// For example, when inserting a component, that component insert may trigger an observer that despawns the entity.
/// So, when you don't have full knowledge of what commands may interact with this entity,
/// do not further use this value without first checking [`is_despawned`](Self::is_despawned).
pub struct EntityWorldMut<'w> {
world: &'w mut World,
entity: Entity,
location: Option<EntityLocation>,
}
impl<'w> EntityWorldMut<'w> {
#[track_caller]
#[inline(never)]
#[cold]
fn panic_despawned(&self) -> ! {
panic!(
"Entity {} {}",
self.entity,
self.world.entities().get_spawned(self.entity).unwrap_err()
);
}
#[inline(always)]
#[track_caller]
pub(crate) fn assert_not_despawned(&self) {
if self.location.is_none() {
self.panic_despawned()
}
}
#[inline(always)]
fn as_unsafe_entity_cell_readonly(&self) -> UnsafeEntityCell<'_> {
let location = self.location();
let last_change_tick = self.world.last_change_tick;View on GitHub (pinned to 396ca72708)
Solutions
- Check is_despawned() before continuing to use the handle
- Avoid using an EntityWorldMut after operations that may despawn the entity (e.g. component inserts that trigger observers)
- Re-fetch the entity via world.get_entity_mut(id) if it may have been despawned
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/bevy_ecs/src/world/entity_access/world_mut.rs:65 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/2c91a61cad1e5903.
Report an issue: GitHub.