{"record":{"id":"ae6867d9c9259e92","repo":"BabylonJS/Babylon.js","slug":"unknown-fbx-property-type-typecode-at-offset","errorCode":null,"errorMessage":"Unknown FBX property type: '${typeCode}' at offset ${offset - 1}","messagePattern":"Unknown FBX property type: '(.+?)' at offset (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts","lineNumber":197,"sourceCode":"            ensureRange(bytes, offset, 4, limit, \"FBX raw property length\");\r\n            const len = view.getUint32(offset, true);\r\n            ensureRange(bytes, offset + 4, len, limit, \"FBX raw property data\");\r\n            const value = bytes.slice(offset + 4, offset + 4 + len);\r\n            return { property: { type: \"raw\", value }, nextOffset: offset + 4 + len };\r\n        }\r\n        // Array types\r\n        case \"f\":\r\n            return parseArrayProperty(view, bytes, offset, \"float32[]\", 4, limit);\r\n        case \"d\":\r\n            return parseArrayProperty(view, bytes, offset, \"float64[]\", 8, limit);\r\n        case \"i\":\r\n            return parseArrayProperty(view, bytes, offset, \"int32[]\", 4, limit);\r\n        case \"l\":\r\n            return parseArrayProperty(view, bytes, offset, \"int64[]\", 8, limit);\r\n        case \"b\":\r\n            return parseArrayProperty(view, bytes, offset, \"boolean[]\", 1, limit);\r\n        default:\r\n            throw new Error(`Unknown FBX property type: '${typeCode}' at offset ${offset - 1}`);\r\n    }\r\n}\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","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/FBX/parsers/fbxBinaryParser.ts#L179-L215","documentation":"Binary FBX properties are prefixed by a single-character type code (y,n,i,l,f,d,b and array types f,d,l,i,b plus S,R). parseProperty switches on that code; any unrecognized character means the byte stream is misaligned or the file uses an unsupported/invalid type code, so parsing stops with the offending code and its offset.","triggerScenarios":"parseProperty (via `result` inside parseNode's property loop) reads a type-code byte not in the supported set — caused by cursor misalignment from an earlier bad length, custom/unknown property types, or reading data bytes as type codes.","commonSituations":"Non-standard exporters writing unsupported type codes; earlier corruption shifting the cursor mid-node; hand-patched FBX binaries.","solutions":["Hexdump around `offset - 1` to see the actual byte and determine whether the cursor is misaligned","Re-export the FBX with a standard tool (Autodesk FBX Converter, Blender) to get canonical type codes","Check whether an earlier node/property threw or mis-sized, shifting all subsequent offsets","Log each property type code in parse order to find the first misalignment point"],"exampleFix":"// before: continuing after a mis-sized property\n// after: validate lengths as you parse\nif (cursor + propSize > propertiesEnd) throw new Error(\"Property overruns node\");","handlingStrategy":"try-catch","validationCode":"// sniff plausible binary FBX and plausible version before parsing\nconst head = new Uint8Array(buffer, 0, 27);\nconst magicOk = String.fromCharCode(...head.slice(0, 20)) === \"Kaydara FBX Binary  \";\nconst versionOk = new DataView(buffer).getUint32(23, true) >= 6000;\nif (!magicOk || !versionOk) throw new Error(\"Refusing to parse suspicious FBX\");","typeGuard":null,"tryCatchPattern":"try {\n  const doc = parseBinaryFBX(buffer);\n} catch (e) {\n  if (/Unknown FBX property type/.test(e.message)) {\n    const m = e.message.match(/'(.+?)' at offset (\\d+)/);\n    console.error(`Bad type code ${m?.[1]} at byte ${m?.[2]} — cursor likely misaligned or non-standard exporter`);\n  } else throw e;\n}","preventionTips":["Convert files from obscure exporters through Autodesk FBX Converter/Blender before parsing","Never continue parsing after a prior bound/length error — errors cascade into misalignment","Validate exporter output against the FBX binary spec in CI if you generate FBX yourself","Inspect the byte at offset-1 in a hexdump to confirm misalignment vs truly unknown type"],"tags":["fbx","binary","property","unknown-type","misaligned"],"backgroundTag":"fbx-corrupt-record","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}