BabylonJS/Babylon.js · error · Error

${context}: Uri is missing or the binary glTF is missing its

Error message

${context}: Uri is missing or the binary glTF is missing its binary chunk

What it means

A glTF buffer must either reference external data via uri, or — for GLB containers — be backed by the binary chunk. This error is thrown when a buffer has no uri AND the loader has no binary chunk (_bin) available, so the buffer data cannot be resolved at all.

Source

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

     * Loads a glTF buffer.
     * @param context The context when loading the asset
     * @param buffer The glTF buffer property
     * @param byteOffset The byte offset to use
     * @param byteLength The byte length to use
     * @returns A promise that resolves with the loaded data when the load is complete
     */
    public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Promise<ArrayBufferView> {
        const extensionPromise = this._extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength);
        if (extensionPromise) {
            return extensionPromise;
        }

        if (!buffer._data) {
            if (buffer.uri) {
                buffer._data = this.loadUriAsync(`${context}/uri`, buffer, buffer.uri);
            } else {
                if (!this._bin) {
                    throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);
                }

                buffer._data = this._bin.readAsync(0, buffer.byteLength);
            }
        }

        return buffer._data.then((data) => {
            try {
                return new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);
            } catch (e) {
                throw new Error(`${context}: ${e.message}`, { cause: e });
            }
        });
    }

    /**
     * Loads a glTF buffer view.
     * @param context The context when loading the asset

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Load the complete GLB including its BIN chunk, not just the JSON.
  2. Add the correct uri to the buffer (e.g. "data.bin") and ship the .bin file alongside.
  3. Embed the buffer as a base64 data URI in the JSON if a single file is required.
  4. Re-export the asset ensuring the binary buffer is written.

Example fix

// before
"buffers": [{ "byteLength": 1024 }]
// after
"buffers": [{ "uri": "scene.bin", "byteLength": 1024 }]
Defensive patterns

Strategy: validation

Validate before calling

for (const buf of gltf.buffers ?? []) {
  if (!buf.uri && !isGlbWithBinChunk) {
    throw new Error(`Buffer without uri and no GLB binary chunk available`);
  }
}

Type guard

function bufferIsResolvable(buf: { uri?: string }, hasBin: boolean): boolean {
  return typeof buf.uri === "string" || hasBin;
}

Try / catch

try { await loadAsset(); } catch (e) {
  if (/Uri is missing or the binary glTF is missing its binary chunk/.test((e as Error).message)) {
    // locate the .bin sidecar or re-download the full GLB
  }
}

Prevention

When it happens

Trigger: Loading a .gltf (JSON) file whose buffer has no uri while expecting GLB-style binary data; loading a GLB whose BIN chunk was stripped; loading only the JSON part of a split .gltf/.bin pair.

Common situations: Renaming/moving a .gltf without its .bin sidecar then hand-removing the uri; tools that export JSON-only but omit buffer uris; serving a GLB truncated so the binary chunk is missing.

Related errors


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