{"record":{"id":"42d9e66579ce4812","repo":"can1357/oh-my-pi","slug":"invalid-cab-archive-unsupported-lzx-block-type","errorCode":null,"errorMessage":"Invalid CAB archive: unsupported LZX block type ${this.#blockType}","messagePattern":"Invalid CAB archive: unsupported LZX block type (.+?)","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/codecs/lzx.ts","lineNumber":260,"sourceCode":"\t\t\tthis.#mainTable = new LzxHuffmanTable(this.#mainLengths);\n\t\t\tif (this.#mainLengths[0xe8] !== 0) this.#intelStarted = true;\n\t\t\treadCodeLengths(reader, this.#lengthLengths, 0, this.#lengthLengths.byteLength);\n\t\t\tthis.#lengthTable = new LzxHuffmanTable(this.#lengthLengths, true);\n\t\t\treturn;\n\t\t}\n\t\tif (this.#blockType === 3) {\n\t\t\tthis.#intelStarted = true;\n\t\t\treader.alignWord();\n\t\t\tthis.#r0 = reader.readUInt32LE();\n\t\t\tthis.#r1 = reader.readUInt32LE();\n\t\t\tthis.#r2 = reader.readUInt32LE();\n\t\t\tif (this.#r0 === 0 || this.#r1 === 0 || this.#r2 === 0) {\n\t\t\t\tthrow new ArchiveError(\"Invalid CAB archive: invalid LZX repeated offset\");\n\t\t\t}\n\t\t\tthis.#uncompressedPadding = (this.#blockLength & 1) !== 0;\n\t\t\treturn;\n\t\t}\n\t\tthrow new ArchiveError(`Invalid CAB archive: unsupported LZX block type ${this.#blockType}`);\n\t}\n\n\t#decodeRun(reader: LzxBitReader, output: Uint8Array, outputStart: number, count: number): number {\n\t\tif (this.#blockType === 3) {\n\t\t\tfor (let index = 0; index < count; index++) this.#writeByte(reader.readByte(), output, outputStart + index);\n\t\t\treturn count;\n\t\t}\n\t\tif (!this.#mainTable || !this.#lengthTable)\n\t\t\tthrow new ArchiveError(\"Invalid CAB archive: missing LZX decode trees\");\n\n\t\tlet produced = 0;\n\t\twhile (produced < count) {\n\t\t\tconst element = this.#mainTable.decode(reader);\n\t\t\tif (element < 256) {\n\t\t\t\tthis.#writeByte(element, output, outputStart + produced);\n\t\t\t\tproduced++;\n\t\t\t\tcontinue;\n\t\t\t}","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/codecs/lzx.ts#L242-L278","documentation":"LZX block types are only 1 (verbatim), 2 (aligned offset), and 3 (uncompressed). #readBlockHeader encountered a block type outside that set, meaning the bitstream is misaligned or corrupt.","triggerScenarios":"decompressFrame -> #readBlockHeader reads a block type byte that is not 1, 2, or 3.","commonSituations":"Bit-reader desync from earlier bad data in the same frame, corrupt CAB payload, or feeding non-LZX bytes into the LZX decoder.","solutions":["Re-extract or re-download the CAB archive.","Check that decompression starts at the correct byte offset (bit alignment at frame start).","Fail fast on ArchiveError; do not attempt to resynchronize mid-frame."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  decompressFrame(reader);\n} catch (err) {\n  if (err instanceof ArchiveError && /unsupported LZX block type/.test(err.message)) {\n    throw new Error(\"CAB payload is corrupt or not LZX\");\n  }\n  throw err;\n}","preventionTips":["Start decoding at a byte-aligned frame boundary","Reject archives failing integrity checks early","Never resume decoding from a mid-stream offset"],"tags":["archive","cab","lzx","corrupt-data"],"backgroundTag":"corrupt-archive-data","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}