{"record":{"id":"3c9d456bb89085a9","repo":"BabylonJS/Babylon.js","slug":"unsupported-fbx-array-encoding-encoding","errorCode":null,"errorMessage":"Unsupported FBX array encoding: ${encoding}","messagePattern":"Unsupported FBX array encoding: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts","lineNumber":217,"sourceCode":"}\r\n\r\nfunction parseArrayProperty(view: DataView, bytes: Uint8Array, offset: number, type: FBXPropertyType, elementSize: number, limit: number): ParsedProperty {\r\n    ensureRange(bytes, offset, 12, limit, `FBX array property header for ${type}`);\r\n    const arrayLength = view.getUint32(offset, true);\r\n    const encoding = view.getUint32(offset + 4, true); // 0=raw, 1=zlib\r\n    const compressedLength = view.getUint32(offset + 8, true);\r\n    offset += 12;\r\n    const expectedByteLength = arrayLength * elementSize;\r\n    ensureRange(bytes, offset, compressedLength, limit, `FBX array property data for ${type}`);\r\n\r\n    let arrayData: Uint8Array;\r\n    if (encoding === 1) {\r\n        // zlib compressed\r\n        const compressed = bytes.subarray(offset, offset + compressedLength);\r\n        arrayData = inflateZlib(compressed, expectedByteLength);\r\n    } else {\r\n        if (encoding !== 0) {\r\n            throw new Error(`Unsupported FBX array encoding: ${encoding}`);\r\n        }\r\n        if (compressedLength !== expectedByteLength) {\r\n            throw new Error(`Invalid FBX array byte length for ${type}`);\r\n        }\r\n        arrayData = bytes.slice(offset, offset + compressedLength);\r\n    }\r\n\r\n    const arrayBuffer = arrayData.buffer.slice(arrayData.byteOffset, arrayData.byteOffset + arrayData.byteLength);\r\n\r\n    let value: Float32Array | Float64Array | Int32Array | Uint8Array;\r\n    switch (type) {\r\n        case \"float32[]\":\r\n            value = new Float32Array(arrayBuffer);\r\n            break;\r\n        case \"float64[]\":\r\n            value = new Float64Array(arrayBuffer);\r\n            break;\r\n        case \"int32[]\":\r","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts#L199-L235","documentation":"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.)","triggerScenarios":"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.","commonSituations":"Corrupted downloads where the encoding byte flipped; hand-crafted FBX; third-party exporters writing unsupported encodings; misaligned cursors from earlier bad property records.","solutions":["Hexdump the array property header at `offset - 1` (arrayLength, encoding, compressedLength) and verify encoding is 0 or 1","Re-export/re-download the FBX to rule out corruption","Check whether an earlier property mis-sized the cursor so a data byte is being read as the encoding","If a tool emits a custom encoding, convert the file through Autodesk FBX Converter or Blender first"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// encoding byte lives inside array properties; can't cheaply pre-check without parsing,\n// but you can verify overall file integrity first:\nif (buffer.byteLength < 27) throw new Error(\"Truncated FBX\");\nconst crcOk = await verifyChecksum(buffer); // compare to known digest when available","typeGuard":null,"tryCatchPattern":"try {\n  const doc = parseBinaryFBX(buffer);\n} catch (e) {\n  if (/Unsupported FBX array encoding/.test(e.message)) {\n    console.error(\"Array property uses an undefined encoding (only 0=raw, 1=zlib valid) — re-export or convert the file\");\n  } else throw e;\n}","preventionTips":["Checksum-verify files after transfer — encoding bytes are single-byte and corruption-prone","Convert non-standard FBX through Autodesk FBX Converter/Blender before parsing","Ensure zlib support (inflateZlib) is available so encoding 1 files parse rather than falling into odd paths","Reject files where an earlier property error occurred; misalignment often surfaces as bogus encodings"],"tags":["fbx","binary","array","encoding","zlib"],"backgroundTag":"fbx-corrupt-record","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}