{"record":{"id":"22e37642a889e83b","repo":"bevyengine/bevy","slug":"no-entities-fit-the-query-0","errorCode":null,"errorMessage":"No entities fit the query {0}","messagePattern":"No entities fit the query (.+?)","errorType":"exception","errorClass":"QuerySingleError","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/query/error.rs","lineNumber":32,"sourceCode":"    /// 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)]\n#[error(\"Cannot contiguously iterate non-dense query {0}\")]\npub struct QueryNotDenseError(pub DebugName);\n\n#[cfg(test)]\nmod test {\n    use crate::{prelude::World, query::QueryEntityError};\n    use bevy_ecs_macros::Component;\n\n    #[test]","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/query/error.rs#L14-L50","documentation":"thiserror Display for QuerySingleError::NoEntities: a single-result API (Query::single, single_mut, single_inner) found zero matching entities where exactly one was expected. The DebugName in {0} identifies the query type that came up empty.","triggerScenarios":"Thrown at crates/bevy_ecs/src/query/error.rs:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use Query::single() -> Option (or get_single) and handle None","Ensure the expected entity actually matches the query (components present, filters pass)","Spawn/insert the required components before the system runs"],"exampleFix":null,"handlingStrategy":"type-guard","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"}