{"record":{"id":"cb82cfcade956f9b","repo":"BabylonJS/Babylon.js","slug":"babylonscenepathtoobjectconverter-path-path","errorCode":null,"errorMessage":"BabylonScenePathToObjectConverter: path \"${path}\" does not start with the expected prefix \"${BABYLON_SCENE_OBJECT_MODEL_PREFIX}\".","messagePattern":"BabylonScenePathToObjectConverter: path \"(.+?)\" does not start with the expected prefix \"(.+?)\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/babylonScenePathToObjectConverter.ts","lineNumber":128,"sourceCode":" * - `/extensions/BABYLON_scene_objects/meshes/17/visible`\r\n *\r\n * Composite path dispatchers (see {@link CompositePathToObjectConverter})\r\n * route paths starting with the prefix here; everything else continues to be\r\n * resolved by the standard glTF converter.\r\n */\r\nexport class BabylonScenePathToObjectConverter implements IPathToObjectConverter<IObjectAccessor> {\r\n    public constructor(\r\n        private _scene: Scene,\r\n        private _tree: IBabylonSceneObjectModelTree\r\n    ) {}\r\n\r\n    /**\r\n     * @param path the full JSON Pointer (must start with the Babylon prefix)\r\n     * @returns an object-info container holding the resolved instance and accessor\r\n     */\r\n    public convert(path: string): IObjectInfo<IObjectAccessor> {\r\n        if (!path.startsWith(BABYLON_SCENE_OBJECT_MODEL_PREFIX)) {\r\n            throw new Error(`BabylonScenePathToObjectConverter: path \"${path}\" does not start with the expected prefix \"${BABYLON_SCENE_OBJECT_MODEL_PREFIX}\".`);\r\n        }\r\n\r\n        // Strip the namespace prefix and split. Ignore trailing empty segments\r\n        // so refs of the form \"/extensions/BABYLON_scene_objects/transformNodes/42/\" parse cleanly.\r\n        const tail = path.slice(BABYLON_SCENE_OBJECT_MODEL_PREFIX.length);\r\n        const parts = tail.split(\"/\").filter((p) => p.length > 0);\r\n        if (parts.length === 0) {\r\n            throw new Error(`BabylonScenePathToObjectConverter: path \"${path}\" is missing a collection name.`);\r\n        }\r\n\r\n        const collectionName = parts[0];\r\n        const collection = (this._tree as unknown as Record<string, IBabylonObjectCollection<any> | undefined>)[collectionName];\r\n        if (!collection) {\r\n            throw new Error(`BabylonScenePathToObjectConverter: unknown collection \"${collectionName}\" in path \"${path}\".`);\r\n        }\r\n\r\n        // Handle `<collection>.length` (no instance lookup).\r\n        if (parts.length === 2 && parts[1] === \"length\") {\r","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/babylonScenePathToObjectConverter.ts#L110-L146","documentation":"BabylonScenePathToObjectConverter.convert() resolves a JSON Pointer referring to a Babylon scene object into an object-info pair for glTF extensions (e.g. BABYLON_scene_objects animation/interpolation targets). It requires every path to begin with the fixed namespace prefix BABYLON_SCENE_OBJECT_MODEL_PREFIX; the library throws this error to fail fast on pointers that were not produced by the Babylon scene-object model. Without this check, an unrelated pointer could be silently misparsed into the wrong collection or instance.","triggerScenarios":"Calling convert() with a path such as \"/nodes/0\" or \"/meshes/1/translation\" instead of one beginning with the Babylon scene-objects prefix (e.g. \"/extensions/BABYLON_scene_objects/...\"); passing a pointer harvested from a non-Babylon glTF extension or a hand-written string.","commonSituations":"Mixing up the generic gltfPathToObjectConverter (which accepts any /-separated path) with the Babylon-specific converter; copying a JSON Pointer from another extension (KHR_animation_pointer etc.); typos or wrong casing in the prefix; building paths by string concatenation that drops the namespace segment.","solutions":["Prefix the path with BABYLON_SCENE_OBJECT_MODEL_PREFIX before calling convert(), or obtain the path from the extension's own reference-building APIs instead of hand-writing it.","Verify you are using BabylonScenePathToObjectConverter only for BABYLON_scene_objects pointers; use gltfPathToObjectConverter for generic glTF paths.","Log the offending path and compare it character-by-character against the exported prefix constant (check for missing leading slash or misspelled extension name)."],"exampleFix":"// before\nconverter.convert(\"/transformNodes/42/position\");\n// after\nconverter.convert(`${BABYLON_SCENE_OBJECT_MODEL_PREFIX}transformNodes/42/position`);","handlingStrategy":"validation","validationCode":"if (!path.startsWith(BABYLON_SCENE_OBJECT_MODEL_PREFIX)) {\n  throw new Error(`Refusing to convert non-Babylon pointer: ${path}`);\n}\nconverter.convert(path);","typeGuard":"function isBabylonScenePath(path: string): boolean {\n  return typeof path === \"string\" && path.startsWith(BABYLON_SCENE_OBJECT_MODEL_PREFIX);\n}","tryCatchPattern":"try {\n  const info = converter.convert(path);\n} catch (e) {\n  // path lacks the Babylon prefix; log and skip this reference\n}","preventionTips":["Always build paths from the exported prefix constant, never raw strings","Keep Babylon-scene pointers and generic glTF pointers in separate code paths","Unit-test every hand-written pointer with isBabylonScenePath"],"tags":["gltf","json-pointer","babylon","path-validation"],"backgroundTag":"json-pointer-invalid-prefix","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}