can1357/oh-my-pi · error · ArchiveError
LZH member '${memberPath}' uses unsupported compression meth
Error message
LZH member '${memberPath}' uses unsupported compression method ${this.#method} What it means
The member's method string passed the format sniff regex (-lh0..7d, -lz4/5s) but is not one of the methods the decoder implements (lh0/4/5/6/7, lz4, lzs). Rather than attempting unknown decompression, the reader rejects the member with its method name in the message.
Source
Thrown at packages/utils/src/ar/lzh.ts:439
case "-lh4-":
output = decompressLhStatic(packed, size, 1 << 12, 4, 13, "LZH -lh4-");
break;
case "-lh5-":
output = decompressLhStatic(packed, size, 1 << 13, 4, 14, "LZH -lh5-");
break;
case "-lh6-":
output = decompressLhStatic(packed, size, 1 << 15, 5, 16, "LZH -lh6-");
break;
case "-lh7-":
output = decompressLhStatic(packed, size, 1 << 16, 5, 17, "LZH -lh7-");
break;
case "-lzs-":
output = decompressLzs(packed, size);
break;
case "-lh1-":
throw new ArchiveError(`LZH member '${memberPath}' uses unsupported dynamic-Huffman method -lh1-`);
default:
throw new ArchiveError(`LZH member '${memberPath}' uses unsupported compression method ${this.#method}`);
}
if (output.byteLength !== size)
throw new ArchiveError(`LZH member '${memberPath}' extracted to an unexpected size`);
if (crc16Arc(output) !== this.#crc)
throw new ArchiveError(`LZH member '${memberPath}' failed CRC-16 verification`);
return output;
}
}
interface ParsedLzhHeader {
method: string;
packedSize: number;
size: number;
dataStart: number;
nextOffset: number;
crc: number;
path?: string;
mtimeMs?: number;View on GitHub (pinned to 9690622007)
Solutions
- Recompress the archive with a modern compressor to -lh5-/-lh6-/-lh7- (e.g. `lha a -lh5`) before reading
- Extract the affected members with an external tool (lhasa, 7-Zip) and process the extracted output instead
- Check for archive corruption: an unexpected method on an otherwise valid archive often means header bytes were damaged
- If you control archive creation, restrict writers to -lh0-/-lh5-..-lh7- methods this library supports
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
// Only these methods are decodable by this library
const SUPPORTED = new Set(["-lh0-","-lh4-","-lh5-","-lh6-","-lh7-","-lz4-","-lzs-"]);
function isSupportedMethod(method: string): boolean {
return SUPPORTED.has(method);
} Type guard
function isSupportedLzhMethod(m: string): m is "-lh0-" | "-lh4-" | "-lh5-" | "-lh6-" | "-lh7-" | "-lz4-" | "-lzs-" {
return ["-lh0-","-lh4-","-lh5-","-lh6-","-lh7-","-lz4-","-lzs-"].includes(m);
} Try / catch
try {
const data = await member.read();
} catch (err) {
if (err instanceof ArchiveError && /unsupported compression method/.test(err.message)) {
// extract this member via an external tool or repack the archive
}
throw err;
} Prevention
- Recompress rare-method archives (-lh2-/-lh3-/-lz5-) with modern tooling before reading
- Treat unexpected method strings on known archives as corruption signals
- Standardize on -lh5-/-lh6-/-lh7- when producing LZH archives
When it happens
Trigger: Reading a member compressed with a recognized-but-unimplemented method such as -lh2-, -lh3-, -lz5-, -lhd- data misparse, or any method string matching the pattern that falls through the switch — e.g. -lh2-/-lh3- legacy dynamic Huffman, -lz5-.
Common situations: Archives created by rare/legacy LHA variants using -lh2-/-lh3-/-lz5-; archives whose header bytes were corrupted into a valid-looking but wrong method string; LHARK or other variant files.
Related errors
- LZH member '${memberPath}' uses unsupported dynamic-Huffman
- Unsupported deb tar compression in '${outerEntry.path}'
- Invalid ${label} Huffman table: oversubscribed codes
- Invalid ${label} Huffman table: incomplete codes
- Invalid ${label} Huffman table: prefix collision
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/cf8c70f3087ed8f8.
Report an issue: GitHub.