BabylonJS/Babylon.js · error · Error

Invalid coordinate system mode (${this._parent.coordinateSys

Error message

Invalid coordinate system mode (${this._parent.coordinateSystemMode})

What it means

The loader switches on the configured coordinateSystemMode after creating the root node. Any value other than the defined GLTFLoaderCoordinateSystemMode enum members (e.g. AUTO, FORCE_LEFT_HANDED, FORCE_RIGHT_HANDED) falls into the default branch, which throws this error.

Source

Thrown at packages/dev/loaders/src/glTF/2.0/glTFLoader.pure.ts:776

            _babylonTransformNode: this._rootBabylonMesh,
            index: -1,
        };

        switch (this._parent.coordinateSystemMode) {
            case GLTFLoaderCoordinateSystemMode.AUTO: {
                if (!this._babylonScene.useRightHandedSystem) {
                    rootNode.rotation = [0, 1, 0, 0];
                    rootNode.scale = [1, 1, -1];
                    GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);
                }
                break;
            }
            case GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {
                this._babylonScene.useRightHandedSystem = true;
                break;
            }
            default: {
                throw new Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`);
            }
        }

        this._parent.onMeshLoadedObservable.notifyObservers(rootMesh);
        return rootNode;
    }

    /**
     * Loads a glTF scene.
     * @param context The context when loading the asset
     * @param scene The glTF scene property
     * @returns A promise that resolves when the load is complete
     */

    public loadSceneAsync(context: string, scene: IScene): Promise<void> {
        const extensionPromise = this._extensionsLoadSceneAsync(context, scene);
        if (extensionPromise) {
            return extensionPromise;

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Set coordinateSystemMode to a GLTFLoaderCoordinateSystemMode enum member (GLTFLoaderCoordinateSystemMode.AUTO, .FORCE_LEFT_HANDED, or .FORCE_RIGHT_HANDED)
  2. Fix typos/invalid raw values in the loader configuration object
  3. After upgrading the library, re-check the enum values and update any persisted numeric literals

Example fix

// before
loader.coordinateSystemMode = 42; // invalid
// after
import { GLTFLoaderCoordinateSystemMode } from "loaders/glTF/2.0/glTFLoader";
loader.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED;
Defensive patterns

Strategy: validation

Validate before calling

import { GLTFLoaderCoordinateSystemMode } from "loaders/glTF/2.0/glTFLoader";
const validModes = [GLTFLoaderCoordinateSystemMode.AUTO,
  GLTFLoaderCoordinateSystemMode.FORCE_LEFT_HANDED,
  GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED];
if (!validModes.includes(loader.coordinateSystemMode)) {
  throw new Error(`coordinateSystemMode must be a GLTFLoaderCoordinateSystemMode member`);
}

Type guard

function isValidCoordinateSystemMode(v) {
  return Object.values(GLTFLoaderCoordinateSystemMode).includes(v);
}

Try / catch

try {
  await loader.loadAsync(url);
} catch (e) {
  if (e.message.startsWith("Invalid coordinate system mode")) {
    console.warn("Fixing coordinateSystemMode to AUTO");
    loader.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;
    return loader.loadAsync(url);
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing an invalid value for loader.coordinateSystemMode (a raw number/string that is not a GLTFLoaderCoordinateSystemMode member) when creating the loader or via GLTFLoader coordinate options.

Common situations: Passing a hand-rolled numeric constant that no longer matches the enum; typing a string like 'right-handed' instead of the enum; enum version drift after upgrading the library.

Related errors


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