BabylonJS/Babylon.js · error

BabylonScenePathToObjectConverter: nested property paths are

Error message

BabylonScenePathToObjectConverter: nested property paths are not yet supported (path "${path}").

What it means

The current walker supports exactly one property segment after the instance id (path length of at most 3 segments: prefix + collection + id + property). Deeper nested paths — e.g. ".../meshes/7/position/x" — are explicitly rejected with this error, since nested property traversal is not yet implemented for the Babylon scene-object leaves.

Source

Thrown at packages/dev/loaders/src/glTF/2.0/Extensions/babylonScenePathToObjectConverter.ts:184

        if (!instance) {
            throw new Error(`BabylonScenePathToObjectConverter: no ${collectionName} instance found with uniqueId ${uniqueId} (path "${path}").`);
        }

        // No property after the id → the ref itself is just a handle to the instance.
        // The accessor's `get` and `getTarget` both return the instance.
        if (parts.length === 2) {
            return {
                object: instance,
                info: this._buildIdentityAccessor(instance),
            };
        }

        // Walk the leaf descriptors for the requested property path. We keep this
        // very simple right now: only one segment after the id is supported, which
        // covers every property the initial leaves expose. Nested paths can be
        // added later by extending the walker.
        if (parts.length > 3) {
            throw new Error(`BabylonScenePathToObjectConverter: nested property paths are not yet supported (path "${path}").`);
        }
        const propertyName = parts[2];
        const leaf = (collection.__array__ as Record<string, IObjectAccessor<any, any, any> | boolean | undefined>)[propertyName];
        if (!leaf || typeof leaf === "boolean") {
            throw new Error(`BabylonScenePathToObjectConverter: property "${propertyName}" is not registered on ${collectionName} (path "${path}").`);
        }

        return {
            object: instance,
            info: leaf as AnyAccessor,
        };
    }

    private _getCollectionArray(collectionName: string): readonly any[] {
        switch (collectionName) {
            case "transformNodes":
                return this._scene.transformNodes;
            case "meshes":

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Flatten the path to a single registered property, e.g. use ".../transformNodes/42/position" instead of ".../transformNodes/42/position/x".
  2. If you need the sub-component, read the returned accessor's value and index into it yourself after conversion.
  3. Check which leaf properties the collection exposes (__array__ descriptors) and address only those directly; extend the walker if nested support is genuinely required.

Example fix

// before
converter.convert(`${prefix}transformNodes/42/position/x`); // nested
// after
const info = converter.convert(`${prefix}transformNodes/42/position`);
const x = info.accessor.get()[0];
Defensive patterns

Strategy: validation

Validate before calling

const parts = path.slice(BABYLON_SCENE_OBJECT_MODEL_PREFIX.length).split("/").filter(Boolean);
if (parts.length > 3) {
  throw new Error(`Nested property paths unsupported: ${path}`);
}
converter.convert(path);

Type guard

function isShallowPropertyPath(path: string): boolean {
  const parts = path.slice(BABYLON_SCENE_OBJECT_MODEL_PREFIX.length).split("/").filter(Boolean);
  return parts.length <= 3;
}

Try / catch

try {
  const info = converter.convert(path);
} catch (e) {
  // nested path: fall back to the single-property accessor and index manually
}

Prevention

When it happens

Trigger: convert() called with more than three slash-separated segments after the prefix, such as ".../transformNodes/42/position/x", ".../meshes/9/rotationQuaternion/y", or any property-of-property reference.

Common situations: Porting paths written for the generic glTF animation-pointer style (which allows nested traversal) to the Babylon converter; assuming sub-component addressing like vector components works; generating paths from a generic schema that doesn't know this converter's one-segment limit.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/5a3a3b6b7cfa61d3. Report an issue: GitHub.