BabylonJS/Babylon.js · error
Path must start with a /
Error message
Path must start with a /
What it means
gltfPathToObjectConverter.convert() walks a glTF JSON Pointer by splitting on '/'; a path not beginning with '/' would produce a bogus first segment, so the converter requires the standard leading slash and throws otherwise. This is the generic (non-Babylon) path-to-object converter used for extension targets like KHR_animation_pointer.
Source
Thrown at packages/dev/loaders/src/glTF/2.0/Extensions/gltfPathToObjectConverter.ts:77
* <digit> := D+
*
* Examples:
* - "/nodes/0/rotation"
* - "/nodes.length"
* - "/materials/2/emissiveFactor"
* - "/materials/2/pbrMetallicRoughness/baseColorFactor"
* - "/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength"
*
* @param path The path to convert
* @returns The object and info associated with the path
*/
public convert(path: string): IObjectInfo<IObjectAccessor<T, BabylonType, BabylonValue>> {
let objectTree: any = this._gltf;
let infoTree: any = this._infoTree;
let target: any = undefined;
if (!path.startsWith("/")) {
throw new Error("Path must start with a /");
}
const parts = path.split("/");
parts.shift();
//if the last part has ".length" in it, separate that as an extra part
if (parts[parts.length - 1].includes(".length")) {
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
View on GitHub (pinned to 0592b347b8)
Solutions
- Ensure the path starts with '/', e.g. "/nodes/0/translation".
- When building from segments, prefix the join: `/${parts.join("/")}`.
- If input comes from config or an external source, normalize it (trim and prepend '/') before calling convert().
Example fix
// before
converter.convert("nodes/0/translation");
// after
converter.convert("/nodes/0/translation"); Defensive patterns
Strategy: validation
Validate before calling
if (typeof path !== "string" || !path.startsWith("/")) {
throw new Error(`glTF pointer must start with '/': ${path}`);
}
converter.convert(path); Type guard
function isJsonPointer(path: unknown): path is string {
return typeof path === "string" && path.startsWith("/");
} Try / catch
try {
const info = converter.convert(path);
} catch (e) {
if (String(e).includes("must start with a /")) {
path = "/" + String(path).replace(/^\/+/, "");
}
} Prevention
- Build pointers as `/${segments.join("/")}` so the leading slash is never lost
- Normalize externally supplied pointers (trim, ensure leading '/') before conversion
- Add a JSON Pointer format check at config-load time
When it happens
Trigger: convert() called with "nodes/0/translation", "extensions/KHR_materials_emissive_strength/emissiveStrength", or any pointer missing the leading '/', including empty strings and paths built by joining segments with '/' but omitting the initial one.
Common situations: Building paths with ["nodes","0","translation"].join("/") instead of "/" + ...join("/"); trimming whitespace or a leading slash accidentally (e.g. .replace(/^\//, "")); receiving a relative reference from user config or an external tool that stores pointers without the leading slash.
Related errors
- BabylonScenePathToObjectConverter: path "${path}" does not s
- BabylonScenePathToObjectConverter: path "${path}" is missing
- BabylonScenePathToObjectConverter: path "${path}" is missing
- BabylonScenePathToObjectConverter: unknown collection "${col
- BabylonScenePathToObjectConverter: invalid uniqueId "${parts
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/db08e1dc0835cbdc.
Report an issue: GitHub.