{"record":{"id":"63355cf9c8b1f4ff","repo":"bevyengine/bevy","slug":"0","errorCode":null,"errorMessage":"{0}","messagePattern":"\\{0\\}","errorType":"exception","errorClass":"QueryEntityError","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/query/error.rs","lineNumber":18,"sourceCode":"use bevy_utils::prelude::DebugName;\n\nuse crate::{\n    archetype::ArchetypeId,\n    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),","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/query/error.rs#L1-L36","documentation":"thiserror Display for QueryEntityError::NotSpawned: the transparently wrapped EntityNotSpawnedError indicates the Entity passed to Query::get is not currently spawned in the world (invalid generation, despawned, or never spawned). The inner error's own Display is shown via {0}.","triggerScenarios":"Thrown at crates/bevy_ecs/src/query/error.rs:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-fetch the entity id after the despawn/spawn cycle that invalidated it","Check Entities::contains(entity) before querying","Flush pending commands so recently spawned entities are visible to the query"],"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-14T00:17:10.932Z"}