{"record":{"id":"1b93e4e2252773e3","repo":"can1357/oh-my-pi","slug":"unsupported-zip-compression-method-method-for","errorCode":null,"errorMessage":"Unsupported ZIP compression method ${method} for '${memberPath}'","messagePattern":"Unsupported ZIP compression method (.+?) for '(.+?)'","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/zip.ts","lineNumber":355,"sourceCode":"\t\t\tcase 0:\n\t\t\t\treturn compressed;\n\t\t\tcase 8:\n\t\t\t\treturn zlib.inflateRawSync(compressed, { maxOutputLength: Math.max(size, 1) });\n\t\t\tcase 12:\n\t\t\t\treturn await bzip2Decompress(compressed, size);\n\t\t\tcase 14: {\n\t\t\t\tif (compressed.byteLength < 9 || compressed[2] !== 5 || compressed[3] !== 0) {\n\t\t\t\t\tthrow new ArchiveError(`Invalid ZIP archive: malformed LZMA properties for '${memberPath}'`);\n\t\t\t\t}\n\t\t\t\treturn await lzmaDecompress(compressed.subarray(4, 9), compressed.subarray(9), size);\n\t\t\t}\n\t\t\tcase 20:\n\t\t\tcase 93:\n\t\t\t\treturn await zstdDecompress(compressed, size);\n\t\t\tcase 95:\n\t\t\t\treturn await xzDecompress(compressed, size);\n\t\t\tdefault:\n\t\t\t\tthrow new ArchiveError(`Unsupported ZIP compression method ${method} for '${memberPath}'`);\n\t\t}\n\t} catch (error) {\n\t\tthrow archiveError(error, `Failed to decompress ZIP member '${memberPath}'`);\n\t}\n}\n\nclass ZipMemberSource implements MemberSource {\n\treadonly #source: ByteSource;\n\treadonly #compressedSize: number;\n\treadonly #method: number;\n\treadonly #flags: number;\n\treadonly #crc: number;\n\treadonly #localHeaderOffset: number;\n\treadonly #limits: ArchiveLimits;\n\n\tconstructor(\n\t\tsource: ByteSource,\n\t\tcompressedSize: number,","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/zip.ts#L337-L373","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Recreate the archive with standard settings: zip -r out.zip files (deflate) or 7z a -tzip -m0=deflate.","If the member is Deflate64, repack with -m0=deflate; if PPMd, switch to deflate or bzip2.","If the entry is AES-encrypted (method 99), decrypt it first with a tool like 7z before reading.","Check the method with unzip -lv archive.zip to identify the codec before choosing a converter."],"exampleFix":"// before: 7z a -tzip archive.zip files -m0=ppmd\n// after\n// 7z a -tzip archive.zip files -m0=deflate  # or plain: zip -r archive.zip files","handlingStrategy":"fallback","validationCode":"const listing = await $`unzip -lv archive.zip`.quiet().nothrow();\nconst methods = (await listing.text()).match(/\\b(Defl|[A-Za-z0-9]+)\\s+\\d+\\s+\\d+%/g) ?? [];\n// or parse the compression-method column and reject unknown codecs before reading","typeGuard":null,"tryCatchPattern":"try {\n  return await archive.readMember(path);\n} catch (err) {\n  if (err instanceof ArchiveError && err.message.startsWith(\"Unsupported ZIP compression method\")) {\n    // fallback: shell out to 7z/unzip to extract this member\n    await $`7z e archive.zip -o${tmpdir} ${path}`.quiet().nothrow();\n    return await Bun.file(`${tmpdir}/${path}`).bytes();\n  } else throw err;\n}","preventionTips":["Standardize on deflate/store when producing archives consumed by this library.","Run unzip -lv in CI to detect exotic codecs early.","Decrypt AES ZIPs before handing them to the parser."],"tags":["zip","compression","unsupported-codec"],"backgroundTag":"unsupported-compression-method","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}