{"record":{"id":"2e41f0a77732c35f","repo":"BabylonJS/Babylon.js","slug":"unexpected-array-type-type","errorCode":null,"errorMessage":"Unexpected array type: ${type}","messagePattern":"Unexpected array type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts","lineNumber":245,"sourceCode":"    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\n            value = new Int32Array(arrayBuffer);\r\n            break;\r\n        case \"boolean[]\":\r\n            value = arrayData;\r\n            break;\r\n        case \"int64[]\":\r\n            value = readInt64ArrayData(arrayData);\r\n            break;\r\n        default:\r\n            throw new Error(`Unexpected array type: ${type}`);\r\n    }\r\n\r\n    return {\r\n        property: { type, value },\r\n        nextOffset: offset + compressedLength,\r\n    };\r\n}\r\n\r\nfunction ensureRange(bytes: Uint8Array, offset: number, byteLength: number, limit: number, context: string): void {\r\n    if (offset < 0 || byteLength < 0 || offset + byteLength > limit || offset + byteLength > bytes.byteLength) {\r\n        throw new Error(`${context}: unexpected end of input`);\r\n    }\r\n}\r\n\r\nfunction readUint64AsNumber(view: DataView, offset: number): number {\r\n    const low = view.getUint32(offset, true);\r\n    const high = view.getUint32(offset + 4, true);\r\n    return high * 0x100000000 + low;\r","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts#L227-L263","documentation":"parseArrayProperty dispatches on the property type string (e.g. 'float[]', 'int64[]') and throws when it encounters an array type it has no reader for. It indicates an FBX array property type code outside the set of supported element types.","triggerScenarios":"Parsing an FBX file containing an array property with an unhandled type string reaching the switch default — i.e., a type code the parser's parseProperty mapped to an array but no case exists for (e.g. a newly introduced or exotic FBX element type, or a mistyped/malformed type field in the record).","commonSituations":"Files exported with unusual FBX versions or proprietary extensions containing new array type codes; hand-crafted FBX binary data; a parser that is out of date relative to the FBX spec coverage needed.","solutions":["Check which type string the error reports and extend the switch in parseArrayProperty with a reader for it","Re-export the asset so all array properties use standard types (float[], int[], double[], int64[], etc.)","Update the loaders package if a newer version added support for that array type","Validate the FBX file with a reference tool to confirm the type code is legitimate"],"exampleFix":"// before\ndefault:\n  throw new Error(`Unexpected array type: ${type}`);\n// after\ncase \"uint64[]\":\n  value = readUint64ArrayData(arrayData);\n  break;\ndefault:\n  throw new Error(`Unexpected array type: ${type}`);","handlingStrategy":"validation","validationCode":"const SUPPORTED_ARRAY_TYPES = new Set(['float[]','int[]','double[]','int64[]','bool[]','byte[]']);\nif (!SUPPORTED_ARRAY_TYPES.has(type)) throw new Error(`Unsupported FBX array type: ${type}`);","typeGuard":"function isSupportedArrayType(t: string): t is SupportedArrayType {\n  return ['float[]','int[]','double[]','int64[]','bool[]','byte[]'].includes(t);\n}","tryCatchPattern":"try {\n  const { property } = parseProperty(bytes, offset);\n} catch (e) {\n  if ((e as Error).message.startsWith('Unexpected array type')) {\n    console.warn('Skipping unsupported FBX array property'); return null;\n  }\n  throw e;\n}","preventionTips":["Keep the supported-type list in sync with the FBX spec versions you must support","Log the offending type string to plan parser extensions","Validate third-party assets with a reference reader before shipping them to users"],"tags":["fbx","binary-parsing","unsupported-type","loaders"],"backgroundTag":"unsupported-array-type","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}