BabylonJS/Babylon.js · error

Unsupported FBX array encoding: ${encoding}

Error message

Unsupported FBX array encoding: ${encoding}

What it means

Binary FBX array properties carry an encoding byte: 0 = raw, 1 = zlib-deflated. parseArrayProperty supports both; any other encoding value is undefined in the format, so it throws rather than guessing. (The related error 'Invalid FBX array byte length' covers encoding 0 with mismatched lengths.)

Source

Thrown at packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts:217

}

function parseArrayProperty(view: DataView, bytes: Uint8Array, offset: number, type: FBXPropertyType, elementSize: number, limit: number): ParsedProperty {
    ensureRange(bytes, offset, 12, limit, `FBX array property header for ${type}`);
    const arrayLength = view.getUint32(offset, true);
    const encoding = view.getUint32(offset + 4, true); // 0=raw, 1=zlib
    const compressedLength = view.getUint32(offset + 8, true);
    offset += 12;
    const expectedByteLength = arrayLength * elementSize;
    ensureRange(bytes, offset, compressedLength, limit, `FBX array property data for ${type}`);

    let arrayData: Uint8Array;
    if (encoding === 1) {
        // zlib compressed
        const compressed = bytes.subarray(offset, offset + compressedLength);
        arrayData = inflateZlib(compressed, expectedByteLength);
    } else {
        if (encoding !== 0) {
            throw new Error(`Unsupported FBX array encoding: ${encoding}`);
        }
        if (compressedLength !== expectedByteLength) {
            throw new Error(`Invalid FBX array byte length for ${type}`);
        }
        arrayData = bytes.slice(offset, offset + compressedLength);
    }

    const arrayBuffer = arrayData.buffer.slice(arrayData.byteOffset, arrayData.byteOffset + arrayData.byteLength);

    let value: Float32Array | Float64Array | Int32Array | Uint8Array;
    switch (type) {
        case "float32[]":
            value = new Float32Array(arrayBuffer);
            break;
        case "float64[]":
            value = new Float64Array(arrayBuffer);
            break;
        case "int32[]":

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Hexdump the array property header at `offset - 1` (arrayLength, encoding, compressedLength) and verify encoding is 0 or 1
  2. Re-export/re-download the FBX to rule out corruption
  3. Check whether an earlier property mis-sized the cursor so a data byte is being read as the encoding
  4. If a tool emits a custom encoding, convert the file through Autodesk FBX Converter or Blender first
Defensive patterns

Strategy: try-catch

Validate before calling

// encoding byte lives inside array properties; can't cheaply pre-check without parsing,
// but you can verify overall file integrity first:
if (buffer.byteLength < 27) throw new Error("Truncated FBX");
const crcOk = await verifyChecksum(buffer); // compare to known digest when available

Try / catch

try {
  const doc = parseBinaryFBX(buffer);
} catch (e) {
  if (/Unsupported FBX array encoding/.test(e.message)) {
    console.error("Array property uses an undefined encoding (only 0=raw, 1=zlib valid) — re-export or convert the file");
  } else throw e;
}

Prevention

When it happens

Trigger: parseArrayProperty (called from parseProperty) reads an encoding byte other than 0 or 1 — corruption in the array property header, cursor misalignment, or a non-standard exporter inventing encodings.

Common situations: Corrupted downloads where the encoding byte flipped; hand-crafted FBX; third-party exporters writing unsupported encodings; misaligned cursors from earlier bad property records.

Related errors


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