bevyengine/bevy · error · EntityComponentError::AliasedMutability
The component with ID {0:?} was requested mutably more than
Error message
The component with ID {0:?} was requested mutably more than once. What it means
EntityComponentError::AliasedMutability: a dynamic component fetch asked for mutable access to the same ComponentId more than once in one call, which would create aliasing &mut references.
Source
Thrown at crates/bevy_ecs/src/world/error.rs:45
/// The bundles' type name.
pub bundle_type: DebugName,
/// The IDs of the provided entities that do not exist.
pub entities: Vec<Entity>,
}
/// An error that occurs when a specified [`Entity`] could not be despawned.
#[derive(thiserror::Error, Debug, Clone, Copy)]
#[error("Could not despawn entity: {0}")]
pub struct EntityDespawnError(#[from] pub EntityNotSpawnedError);
/// An error that occurs when dynamically retrieving components from an entity.
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
pub enum EntityComponentError {
/// The component with the given [`ComponentId`] does not exist on the entity.
#[error("The component with ID {0:?} does not exist on the entity.")]
MissingComponent(ComponentId),
/// The component with the given [`ComponentId`] was requested mutably more than once.
#[error("The component with ID {0:?} was requested mutably more than once.")]
AliasedMutability(ComponentId),
}
/// An error that occurs when fetching entities mutably from a world.
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
pub enum EntityMutableFetchError {
/// The entity is not spawned.
#[error(
"{0}\n
If you were attempting to apply a command to this entity,
and want to handle this error gracefully, consider using `EntityCommands::queue_handled` or `queue_silenced`."
)]
NotSpawned(#[from] EntityNotSpawnedError),
/// The entity with the given ID was requested mutably more than once.
#[error("The entity with ID {0} was requested mutably more than once")]
AliasedMutability(Entity),
}
View on GitHub (pinned to 396ca72708)
Solutions
- Request each component mutably only once per fetch
- Split the mutation into separate sequential operations
- Use the read-only fetch for the duplicate access
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_ecs/src/world/error.rs:45 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/ba558dc521a3a3c7.
Report an issue: GitHub.