{"record":{"id":"8c837701f9c9dacc","repo":"BabylonJS/Babylon.js","slug":"path-path-is-invalid-8c8377","errorCode":null,"errorMessage":"Path ${path} is invalid","messagePattern":"Path (.+?) is invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/gltfPathToObjectConverter.ts","lineNumber":102,"sourceCode":"            const lastPart = parts[parts.length - 1];\r\n            const split = lastPart.split(\".\");\r\n            parts.pop();\r\n            parts.push(...split);\r\n        }\r\n\r\n        let ignoreObjectTree = false;\r\n\r\n        for (const part of parts) {\r\n            const isLength = part === \"length\";\r\n            if (isLength) {\r\n                // For .length, check if the current level has a 'length' accessor\r\n                if (infoTree.length) {\r\n                    infoTree = infoTree.length;\r\n                } else if (infoTree.__array__) {\r\n                    // Fallback: length of an array that doesn't have explicit length accessor\r\n                    throw new Error(`Path ${path} is invalid - no length accessor`);\r\n                } else {\r\n                    throw new Error(`Path ${path} is invalid`);\r\n                }\r\n                // Set target to the current object tree (the array itself)\r\n                // Only update target if objectTree is defined, otherwise keep the last valid target\r\n                if (objectTree !== undefined) {\r\n                    target = objectTree;\r\n                }\r\n                continue;\r\n            }\r\n            if (infoTree.__ignoreObjectTree__) {\r\n                ignoreObjectTree = true;\r\n            }\r\n            if (infoTree.__array__) {\r\n                infoTree = infoTree.__array__;\r\n            } else {\r\n                infoTree = infoTree[part];\r\n                if (!infoTree) {\r\n                    throw new Error(`Path ${path} is invalid`);\r\n                }\r","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/gltfPathToObjectConverter.ts#L84-L120","documentation":"Same resolution loop in GLTFPathToObjectConverter.convert(): when a `.length` segment is encountered and the current info level has neither a `length` accessor nor an `__array__` marker, the level is not an array at all, so the loader throws this generic invalid-path error.","triggerScenarios":"Requesting a `.length` pointer (e.g. `/materials.length`) where the segment before `.length` resolves to a scalar/object property in the info tree (not an array and not carrying a length accessor).","commonSituations":"Typo in a property pointer inside an animation or interactivity graph; applying `.length` to a non-array property like `/materials/0/pbrMetallicRoughness/baseColorFactor.length`; asset authored against an object-model version that lacks the property.","solutions":["Verify the property before `.length` is actually a glTF array in the object model","Remove the `.length` suffix or target a real array root (`/nodes.length`, `/meshes.length`, etc.)","Inspect this._infoTree to confirm the segment exists; a missing segment usually indicates a typo","Upgrade Babylon.js if the property was added in a newer object model"],"exampleFix":"// before\nconverter.convert(\"/nodes/0/translation.length\"); // translation is a value, not an array root\n// after\nconverter.convert(\"/nodes.length\");","handlingStrategy":"validation","validationCode":"const m = /^(\\/[a-zA-Z]+)\\.length$/.exec(path);\nif (m) {\n    const root = m[1].slice(1);\n    if (!Array.isArray((gltf as any)[root])) throw new Error(`.length pointer requires an array root: ${path}`);\n}","typeGuard":"function isLengthPointerOnArray(path: string, gltf: any): boolean {\n    if (!path.endsWith(\".length\")) return false;\n    const root = path.slice(1, -\".length\".length);\n    return Array.isArray((gltf as any)[root]);\n}","tryCatchPattern":"try {\n    return converter.convert(path);\n} catch (e) {\n    if (String(e.message).includes(\"is invalid\")) {\n        console.warn(`glTF pointer rejected: ${path}`);\n        return null;\n    }\n    throw e;\n}","preventionTips":["Never append .length to per-element property pointers","Check for typos by verifying each pointer segment against the glTF JSON","Use Khronos glTF-Validator on assets before loading","Keep pointer tables in one place so they can be lint-checked"],"tags":["gltf","json-pointer","path-resolution"],"backgroundTag":"invalid-gltf-pointer","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}