{"record":{"id":"c82328006b963f6f","repo":"bevyengine/bevy","slug":"the-entity-with-id-0-was-requested-mutably-more","errorCode":null,"errorMessage":"The entity with ID {0} was requested mutably more than once","messagePattern":"The entity with ID (.+?) was requested mutably more than once","errorType":"exception","errorClass":"QueryEntityError","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/query/error.rs","lineNumber":23,"sourceCode":"    entity::{Entity, EntityNotSpawnedError},\n};\n\n/// An error that occurs when retrieving a specific [`Entity`]'s query result from [`Query`](crate::system::Query) or [`QueryState`](crate::query::QueryState).\n// TODO: return the type_name as part of this error\n#[derive(thiserror::Error, Clone, Copy, Debug, PartialEq, Eq)]\npub enum QueryEntityError {\n    /// The given [`Entity`]'s components do not match the query.\n    ///\n    /// Either it does not have a requested component, or it has a component which the query filters out.\n    #[error(\"The query does not match entity {0}\")]\n    QueryDoesNotMatch(Entity, ArchetypeId),\n    /// The given [`Entity`] is not spawned.\n    #[error(\"{0}\")]\n    NotSpawned(#[from] EntityNotSpawnedError),\n    /// The [`Entity`] was requested mutably more than once.\n    ///\n    /// See [`Query::get_many_mut`](crate::system::Query::get_many_mut) for an example.\n    #[error(\"The entity with ID {0} was requested mutably more than once\")]\n    AliasedMutability(Entity),\n}\n\n/// An error that occurs when evaluating a [`Query`](crate::system::Query) or [`QueryState`](crate::query::QueryState) as a single expected result via\n/// [`single`](crate::system::Query::single) or [`single_mut`](crate::system::Query::single_mut).\n#[derive(Debug, thiserror::Error)]\npub enum QuerySingleError {\n    /// No entity fits the query.\n    #[error(\"No entities fit the query {0}\")]\n    NoEntities(DebugName),\n    /// Multiple entities fit the query.\n    #[error(\"Multiple entities fit the query {0}\")]\n    MultipleEntities(DebugName),\n}\n\n/// An error that occurs when creating a contiguous iterator from a non-dense [`Query`](crate::system::Query) or [`QueryState`](crate::query::QueryState) via\n/// [`contiguous_iter`](crate::system::Query::contiguous_iter) or [`contiguous_iter_mut`](crate::system::Query::contiguous_iter_mut).\n#[derive(Debug, thiserror::Error)]","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/query/error.rs#L5-L41","documentation":"thiserror Display for QueryEntityError::AliasedMutability: Query::get_many_mut (or similar batched mutable access) received the same Entity more than once in its list. Two &mut bindings to one entity would alias mutable borrows, so the API validates for duplicates and reports the offending id.","triggerScenarios":"Thrown at crates/bevy_ecs/src/query/error.rs:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Deduplicate the entity list before calling get_many_mut","Split overlapping entities into sequential get_mut calls","Use a ParamSet or iter().find() pattern when the set of entities is not known disjoint"],"exampleFix":null,"handlingStrategy":"validation","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"}