{"record":{"id":"cc3c8188092b3cd0","repo":"BabylonJS/Babylon.js","slug":"no-collection-id-replace-query-found-wi","errorCode":null,"errorMessage":"No ${collection.id.replace(\"query-\", \"\")} found with uniqueId ${id}.","messagePattern":"No (.+?) found with uniqueId (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/inspector-v2/src/services/cli/entityQueryService.ts","lineNumber":130,"sourceCode":"                return JSON.stringify([], null, 2);\r\n            }\r\n\r\n            if (!args.uniqueId) {\r\n                return JSON.stringify(\r\n                    entities.map((e) => collection.getSummary(e)),\r\n                    null,\r\n                    2\r\n                );\r\n            }\r\n\r\n            const id = parseInt(args.uniqueId, 10);\r\n            if (isNaN(id)) {\r\n                throw new Error(\"uniqueId must be a number.\");\r\n            }\r\n\r\n            const entity = entities.find((e) => collection.getUniqueId(e) === id);\r\n            if (!entity) {\r\n                throw new Error(`No ${collection.id.replace(\"query-\", \"\")} found with uniqueId ${id}.`);\r\n            }\r\n\r\n            return JSON.stringify(collection.serialize ? collection.serialize(entity) : collection.getSummary(entity), null, 2);\r\n        },\r\n    };\r\n}\r\n\r\n/**\r\n * Service that registers CLI commands for querying scene entities by uniqueId.\r\n * When uniqueId is omitted, returns a summary list of all entities of that type.\r\n */\r\nexport const EntityQueryServiceDefinition: ServiceDefinition<[], [IBridgeCommandRegistry, ISceneContext]> = {\r\n    friendlyName: \"Entity Query Service\",\r\n    consumes: [BridgeCommandRegistryIdentity, SceneContextIdentity],\r\n    factory: (commandRegistry, sceneContext) => {\r\n        const collections = [\r\n            {\r\n                id: \"query-mesh\",\r","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/inspector-v2/src/services/cli/entityQueryService.ts#L112-L148","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nexecute(\"make-query\", { uniqueId: \"9999\" }); // entity disposed after scene reload\n// after\nconst list = JSON.parse(execute(\"query-meshes\", {}));\nexecute(\"make-query\", { uniqueId: String(list[0].uniqueId) });","handlingStrategy":"validation","validationCode":"const entity = entities.find((e) => collection.getUniqueId(e) === id);\nif (!entity) throw new RangeError(`uniqueId ${id} not in collection ${collection.id}; call list first.`);","typeGuard":null,"tryCatchPattern":"try {\n  return await makeQuery({ uniqueId: String(id) });\n} catch (e) {\n  if (e instanceof Error && /No .* found with uniqueId/.test(e.message)) {\n    return listCollectionSummaries(); // recover by listing live ids\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["cli","entity-not-found","lookup"],"backgroundTag":"entity-not-found","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}