BabylonJS/Babylon.js · error
Path ${path} is invalid
Error message
Path ${path} is invalid What it means
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.
Source
Thrown at packages/dev/loaders/src/glTF/2.0/Extensions/gltfPathToObjectConverter.ts:102
const lastPart = parts[parts.length - 1];
const split = lastPart.split(".");
parts.pop();
parts.push(...split);
}
let ignoreObjectTree = false;
for (const part of parts) {
const isLength = part === "length";
if (isLength) {
// For .length, check if the current level has a 'length' accessor
if (infoTree.length) {
infoTree = infoTree.length;
} else if (infoTree.__array__) {
// Fallback: length of an array that doesn't have explicit length accessor
throw new Error(`Path ${path} is invalid - no length accessor`);
} else {
throw new Error(`Path ${path} is invalid`);
}
// Set target to the current object tree (the array itself)
// Only update target if objectTree is defined, otherwise keep the last valid target
if (objectTree !== undefined) {
target = objectTree;
}
continue;
}
if (infoTree.__ignoreObjectTree__) {
ignoreObjectTree = true;
}
if (infoTree.__array__) {
infoTree = infoTree.__array__;
} else {
infoTree = infoTree[part];
if (!infoTree) {
throw new Error(`Path ${path} is invalid`);
}
View on GitHub (pinned to 0592b347b8)
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
Example fix
// before
converter.convert("/nodes/0/translation.length"); // translation is a value, not an array root
// after
converter.convert("/nodes.length"); Defensive patterns
Strategy: validation
Validate before calling
const m = /^(\/[a-zA-Z]+)\.length$/.exec(path);
if (m) {
const root = m[1].slice(1);
if (!Array.isArray((gltf as any)[root])) throw new Error(`.length pointer requires an array root: ${path}`);
} Type guard
function isLengthPointerOnArray(path: string, gltf: any): boolean {
if (!path.endsWith(".length")) return false;
const root = path.slice(1, -".length".length);
return Array.isArray((gltf as any)[root]);
} Try / catch
try {
return converter.convert(path);
} catch (e) {
if (String(e.message).includes("is invalid")) {
console.warn(`glTF pointer rejected: ${path}`);
return null;
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Path ${path} is invalid - no length accessor
- BabylonScenePathToObjectConverter: path "${path}" does not s
- BabylonScenePathToObjectConverter: path "${path}" is missing
- BabylonScenePathToObjectConverter: unknown collection "${col
- BabylonScenePathToObjectConverter: path "${path}" is missing
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/8c837701f9c9dacc.
Report an issue: GitHub.