can1357/oh-my-pi · error · ArchiveError

Unsupported ZIP compression method ${method} for '${memberPa

Error message

Unsupported ZIP compression method ${method} for '${memberPath}'

What it means

The ZIP entry uses a compression method this library does not implement. Supported methods are 0 (store), 8 (deflate), 12 (bzip2), 14 (LZMA), 20/93 (Zstandard), and 95 (xz); anything else — e.g. method 9 (Deflate64), 1-7 (shrunk/reduced), 98 (PPMd), or 99 (AES) — is rejected when the member is read.

Source

Thrown at packages/utils/src/ar/zip.ts:355

			case 0:
				return compressed;
			case 8:
				return zlib.inflateRawSync(compressed, { maxOutputLength: Math.max(size, 1) });
			case 12:
				return await bzip2Decompress(compressed, size);
			case 14: {
				if (compressed.byteLength < 9 || compressed[2] !== 5 || compressed[3] !== 0) {
					throw new ArchiveError(`Invalid ZIP archive: malformed LZMA properties for '${memberPath}'`);
				}
				return await lzmaDecompress(compressed.subarray(4, 9), compressed.subarray(9), size);
			}
			case 20:
			case 93:
				return await zstdDecompress(compressed, size);
			case 95:
				return await xzDecompress(compressed, size);
			default:
				throw new ArchiveError(`Unsupported ZIP compression method ${method} for '${memberPath}'`);
		}
	} catch (error) {
		throw archiveError(error, `Failed to decompress ZIP member '${memberPath}'`);
	}
}

class ZipMemberSource implements MemberSource {
	readonly #source: ByteSource;
	readonly #compressedSize: number;
	readonly #method: number;
	readonly #flags: number;
	readonly #crc: number;
	readonly #localHeaderOffset: number;
	readonly #limits: ArchiveLimits;

	constructor(
		source: ByteSource,
		compressedSize: number,

View on GitHub (pinned to 9690622007)

Solutions

  1. Recreate the archive with standard settings: zip -r out.zip files (deflate) or 7z a -tzip -m0=deflate.
  2. If the member is Deflate64, repack with -m0=deflate; if PPMd, switch to deflate or bzip2.
  3. If the entry is AES-encrypted (method 99), decrypt it first with a tool like 7z before reading.
  4. Check the method with unzip -lv archive.zip to identify the codec before choosing a converter.

Example fix

// before: 7z a -tzip archive.zip files -m0=ppmd
// after
// 7z a -tzip archive.zip files -m0=deflate  # or plain: zip -r archive.zip files
Defensive patterns

Strategy: fallback

Validate before calling

const listing = await $`unzip -lv archive.zip`.quiet().nothrow();
const methods = (await listing.text()).match(/\b(Defl|[A-Za-z0-9]+)\s+\d+\s+\d+%/g) ?? [];
// or parse the compression-method column and reject unknown codecs before reading

Try / catch

try {
  return await archive.readMember(path);
} catch (err) {
  if (err instanceof ArchiveError && err.message.startsWith("Unsupported ZIP compression method")) {
    // fallback: shell out to 7z/unzip to extract this member
    await $`7z e archive.zip -o${tmpdir} ${path}`.quiet().nothrow();
    return await Bun.file(`${tmpdir}/${path}`).bytes();
  } else throw err;
}

Prevention

When it happens

Trigger: Calling read/extract on a ZIP member whose compression method byte is not in the supported set; the check happens both in decodeMember's default branch and in ZipMemberSource.read before decompression.

Common situations: Archives created with 7-Zip using PPMd or Deflate64, WinZip AES-encrypted entries (method 99, also caught by the encryption check), old PKZIP archives using implode/shrink, zstd-in-zip from nonstandard tooling (varies by method number).

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/1b93e4e2252773e3. Report an issue: GitHub.