{"record":{"id":"e2f642f65d3cc886","repo":"can1357/oh-my-pi","slug":"unsupported-zip-compression-method-this-method","errorCode":null,"errorMessage":"Unsupported ZIP compression method ${this.#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":396,"sourceCode":"\t\tlimits: ArchiveLimits,\n\t) {\n\t\tthis.#source = source;\n\t\tthis.#compressedSize = compressedSize;\n\t\tthis.#method = method;\n\t\tthis.#flags = flags;\n\t\tthis.#crc = crc;\n\t\tthis.#localHeaderOffset = localHeaderOffset;\n\t\tthis.#limits = limits;\n\t}\n\n\tasync read(size: number, memberPath: string): Promise<Uint8Array> {\n\t\ttry {\n\t\t\tassertArchiveMemberSize(Math.max(size, this.#compressedSize), memberPath, this.#limits);\n\t\t\tif ((this.#flags & (ENCRYPTED_FLAG | STRONG_ENCRYPTION_FLAG)) !== 0 || this.#method === 99) {\n\t\t\t\tthrow new ArchiveError(`Encrypted ZIP member '${memberPath}' is not supported`);\n\t\t\t}\n\t\t\tif (SUPPORTED_METHODS[this.#method] !== true) {\n\t\t\t\tthrow new ArchiveError(`Unsupported ZIP compression method ${this.#method} for '${memberPath}'`);\n\t\t\t}\n\t\t\tconst headerEnd = checkedEnd(\n\t\t\t\tthis.#localHeaderOffset,\n\t\t\t\t30,\n\t\t\t\tthis.#source.size,\n\t\t\t\t`local header for '${memberPath}'`,\n\t\t\t);\n\t\t\tconst header = await this.#source.read(this.#localHeaderOffset, headerEnd);\n\t\t\tif (header.byteLength !== 30 || readUInt32LE(header, 0) !== LOCAL_HEADER_SIGNATURE) {\n\t\t\t\tthrow new ArchiveError(`Invalid ZIP archive: malformed local header for '${memberPath}'`);\n\t\t\t}\n\t\t\tconst localFlags = readUInt16LE(header, 6);\n\t\t\tif ((localFlags & (ENCRYPTED_FLAG | STRONG_ENCRYPTION_FLAG)) !== 0) {\n\t\t\t\tthrow new ArchiveError(`Encrypted ZIP member '${memberPath}' is not supported`);\n\t\t\t}\n\t\t\tif (readUInt16LE(header, 8) !== this.#method) {\n\t\t\t\tthrow new ArchiveError(\n\t\t\t\t\t`Invalid ZIP archive: local and central compression methods disagree for '${memberPath}'`,","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/zip.ts#L378-L414","documentation":"Thrown when a ZIP member's central directory declares a compression method this reader does not implement (anything other than stored=0, deflate=8, or the same check treats 99 as encrypted first). The library only supports a fixed set of methods (SUPPORTED_METHODS), so exotic codecs like bzip2 (12), LZMA (14), or zstd (93) are rejected instead of producing garbage. It is an ArchiveError naming the offending member.","triggerScenarios":"Calling a ZIP read/extract API (ZipMemberSource read path) on an archive whose central directory entry has method not in {0,8}; the same member also throws first if method===99 (AES) or encryption flags are set.","commonSituations":"Downloading archives produced by 7-Zip or Info-ZIP with bzip2/LZMA/zstd compression selected; AES-encrypted zips written by WinZip (method 99); zips created by tools defaulting to newer codecs; opening Java/Gradle wrappers or package archives compressed with non-deflate settings.","solutions":["Recompress/re-save the ZIP with standard Deflate (e.g. `zip -r out.zip dir` or 7-Zip 'ZIP (deflate)') and retry","Detect method 99: decrypt the archive yourself first — these zips are password-protected, not merely differently-compressed","Inspect the member's method with `unzip -lv archive.zip` to confirm which codec was used","If you control the producer, force deflate (`7z a -tzip -mm=Deflate`) rather than the tool's default"],"exampleFix":"// before (shell): archive compressed with zstd inside zip\n7z a -tzip -mm=ZSTD out.zip dir/   // reader throws 3710\n// after\n7z a -tzip -mm=Deflate out.zip dir/","handlingStrategy":"validation","validationCode":"// Peek the method from the central directory before extraction\n// (or simply check with unzip -lv out.zip that methods are 'Stored'/'Deflated')\nconst SUPPORTED = new Set([0, 8]);\nif (!SUPPORTED.has(entry.method)) throw new Error(`unsupported zip method ${entry.method}; recompress with deflate`);","typeGuard":null,"tryCatchPattern":"try {\n  const data = await zip.read(member);\n} catch (err) {\n  if (err instanceof ArchiveError && /Unsupported ZIP compression method/.test(err.message)) {\n    // fall back to external tool: $`7z x -mm=Deflate archive.zip`\n  } else throw err;\n}","preventionTips":["Prefer deflate when creating zips shared with this library","Check `unzip -lv` output for 'bzip2'/'LZMA'/'zstd' methods before ingesting third-party archives","Treat method 99 entries as encrypted and require a password upstream","Document codec restrictions wherever archives are accepted as input"],"tags":["zip","compression","unsupported-codec","archive-parsing"],"backgroundTag":"unsupported-zip-compression-method","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}