can1357/oh-my-pi · error · ArchiveError
Invalid CAB archive: unsupported LZX block type ${this.#bloc
Error message
Invalid CAB archive: unsupported LZX block type ${this.#blockType} What it means
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.
Source
Thrown at packages/utils/src/ar/codecs/lzx.ts:260
this.#mainTable = new LzxHuffmanTable(this.#mainLengths);
if (this.#mainLengths[0xe8] !== 0) this.#intelStarted = true;
readCodeLengths(reader, this.#lengthLengths, 0, this.#lengthLengths.byteLength);
this.#lengthTable = new LzxHuffmanTable(this.#lengthLengths, true);
return;
}
if (this.#blockType === 3) {
this.#intelStarted = true;
reader.alignWord();
this.#r0 = reader.readUInt32LE();
this.#r1 = reader.readUInt32LE();
this.#r2 = reader.readUInt32LE();
if (this.#r0 === 0 || this.#r1 === 0 || this.#r2 === 0) {
throw new ArchiveError("Invalid CAB archive: invalid LZX repeated offset");
}
this.#uncompressedPadding = (this.#blockLength & 1) !== 0;
return;
}
throw new ArchiveError(`Invalid CAB archive: unsupported LZX block type ${this.#blockType}`);
}
#decodeRun(reader: LzxBitReader, output: Uint8Array, outputStart: number, count: number): number {
if (this.#blockType === 3) {
for (let index = 0; index < count; index++) this.#writeByte(reader.readByte(), output, outputStart + index);
return count;
}
if (!this.#mainTable || !this.#lengthTable)
throw new ArchiveError("Invalid CAB archive: missing LZX decode trees");
let produced = 0;
while (produced < count) {
const element = this.#mainTable.decode(reader);
if (element < 256) {
this.#writeByte(element, output, outputStart + produced);
produced++;
continue;
}View on GitHub (pinned to 9690622007)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try {
decompressFrame(reader);
} catch (err) {
if (err instanceof ArchiveError && /unsupported LZX block type/.test(err.message)) {
throw new Error("CAB payload is corrupt or not LZX");
}
throw err;
} Prevention
- Start decoding at a byte-aligned frame boundary
- Reject archives failing integrity checks early
- Never resume decoding from a mid-stream offset
When it happens
Trigger: decompressFrame -> #readBlockHeader reads a block type byte that is not 1, 2, or 3.
Common situations: Bit-reader desync from earlier bad data in the same frame, corrupt CAB payload, or feeding non-LZX bytes into the LZX decoder.
Related errors
- Invalid CAB archive: misaligned LZX byte stream
- Invalid CAB archive: invalid LZX Huffman code length
- Invalid CAB archive: invalid LZX repeated offset
- Invalid CAB archive: LZX match crosses a frame or block boun
- Invalid CAB archive: LZX position slot is out of range
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/42d9e66579ce4812.
Report an issue: GitHub.