BabylonJS/Babylon.js · error
No ${collection.id.replace("query-", "")} found with uniqueI
Error message
No ${collection.id.replace("query-", "")} found with uniqueId ${id}. What it means
Thrown by the make-query CLI command when the parsed uniqueId is a valid number but no entity in the selected query collection has that uniqueId. The command enumerates the collection's entities and compares collection.getUniqueId(e) against the id. This is a lookup failure, not an argument format problem.
Source
Thrown at packages/dev/inspector-v2/src/services/cli/entityQueryService.ts:130
return JSON.stringify([], null, 2);
}
if (!args.uniqueId) {
return JSON.stringify(
entities.map((e) => collection.getSummary(e)),
null,
2
);
}
const id = parseInt(args.uniqueId, 10);
if (isNaN(id)) {
throw new Error("uniqueId must be a number.");
}
const entity = entities.find((e) => collection.getUniqueId(e) === id);
if (!entity) {
throw new Error(`No ${collection.id.replace("query-", "")} found with uniqueId ${id}.`);
}
return JSON.stringify(collection.serialize ? collection.serialize(entity) : collection.getSummary(entity), null, 2);
},
};
}
/**
* Service that registers CLI commands for querying scene entities by uniqueId.
* When uniqueId is omitted, returns a summary list of all entities of that type.
*/
export const EntityQueryServiceDefinition: ServiceDefinition<[], [IBridgeCommandRegistry, ISceneContext]> = {
friendlyName: "Entity Query Service",
consumes: [BridgeCommandRegistryIdentity, SceneContextIdentity],
factory: (commandRegistry, sceneContext) => {
const collections = [
{
id: "query-mesh",
View on GitHub (pinned to 0592b347b8)
Solutions
- List the current entities in the collection (make-query without the id, or the collection's list command) and use a uniqueId that exists.
- Confirm you are querying the right collection — the error message names it (collection.id minus the "query-" prefix).
- Re-run any setup that created the entity if the scene was reloaded; uniqueIds are only valid for live entities.
Example fix
// before
execute("make-query", { uniqueId: "9999" }); // entity disposed after scene reload
// after
const list = JSON.parse(execute("query-meshes", {}));
execute("make-query", { uniqueId: String(list[0].uniqueId) }); Defensive patterns
Strategy: validation
Validate before calling
const entity = entities.find((e) => collection.getUniqueId(e) === id);
if (!entity) throw new RangeError(`uniqueId ${id} not in collection ${collection.id}; call list first.`); Try / catch
try {
return await makeQuery({ uniqueId: String(id) });
} catch (e) {
if (e instanceof Error && /No .* found with uniqueId/.test(e.message)) {
return listCollectionSummaries(); // recover by listing live ids
}
throw e;
} Prevention
- Re-fetch ids after every scene reload or hot reload; do not cache uniqueIds.
- Check the collection named in the error matches the one you intended.
- Wrap lookups to list valid ids when a lookup misses.
When it happens
Trigger: Calling 'make-query' with a well-formed numeric uniqueId that does not match any entity currently in the collection (entity was disposed, scene reloaded, or id never existed).
Common situations: Referencing an entity from a previous run/scene load after ids were reassigned; typo in the id (42 vs 421); querying the wrong collection for that id; hot-reload disposing the target entity.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- No camera found with uniqueId ${cameraId}.
- Unable to connect to the Inspector bridge on port ${port} af
- Session id must be a number.
- Session ${parsed} does not exist. No active sessions.
- Session ${parsed} does not exist. Active sessions: ${list}
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/cc3c8188092b3cd0.
Report an issue: GitHub.