{"record":{"id":"d649eb3dff8f117f","repo":"can1357/oh-my-pi","slug":"unsupported-rar4-compression-method-0x-record-me","errorCode":null,"errorMessage":"Unsupported RAR4 compression method 0x${(record.method + 0x30).toString(16)} for '${record.path}' / Unsupported RAR5 compression method ${record.method} for '${record.path}'","messagePattern":"Unsupported RAR4 compression method 0x(.+?) for '(.+?)' / Unsupported RAR5 compression method (.+?) for '(.+?)'","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/rar.ts","lineNumber":97,"sourceCode":"\n\tasync #decode(index: number): Promise<void> {\n\t\tconst target = this.#records[index];\n\t\tif (!target) throw new ArchiveError(\"Invalid RAR member index\");\n\t\tlet start = index;\n\t\tif (target.solid) {\n\t\t\twhile (start > 0 && this.#records[start]!.solid && this.#records[start - 1]!.format === target.format) start--;\n\t\t}\n\t\tconst rar4Decoder = new Rar4Decoder();\n\t\tconst rar5Decoder = new Rar5Decoder();\n\t\tfor (let current = start; current <= index; current++) {\n\t\t\tconst record = this.#records[current]!;\n\t\t\tif (record.isDirectory) continue;\n\t\t\tassertArchiveMemberSize(record.unpackedSize, record.path, this.#limits);\n\t\t\tif (record.method === 0 && record.packedSize !== record.unpackedSize) {\n\t\t\t\tcorrupt(\"stored member size mismatch\");\n\t\t\t}\n\t\t\tif (record.method > 5) {\n\t\t\t\tthrow new ArchiveError(\n\t\t\t\t\trecord.format === 4\n\t\t\t\t\t\t? `Unsupported RAR4 compression method 0x${(record.method + 0x30).toString(16)} for '${record.path}'`\n\t\t\t\t\t\t: `Unsupported RAR5 compression method ${record.method} for '${record.path}'`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (record.method !== 0) {\n\t\t\t\tassertInMemorySize(\n\t\t\t\t\trecord.packedSize + 2 * record.unpackedSize + 2 * record.dictionarySize + 8192,\n\t\t\t\t\tthis.#limits,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst end = checkedEnd(record.dataStart, record.packedSize, this.#source.size, \"member data\");\n\t\t\tconst packed = await this.#source.read(record.dataStart, end);\n\t\t\tlet output: Uint8Array;\n\t\t\tif (record.method === 0) {\n\t\t\t\toutput = packed;\n\t\t\t\tif (record.solid) {\n\t\t\t\t\tif (record.format === 4) rar4Decoder.reset();","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/rar.ts#L79-L115","documentation":"RAR4 methods are stored as 0x30-0x35 ('0'-'5') and RAR5 as 0-5; method 0 means stored. #decode rejects any record with method > 5, formatting the message per format version, because the decoder cannot inflate methods it does not implement.","triggerScenarios":"Decoding an archive whose member header carries compression method 6+ — either a corrupted method byte, or a RAR7/newer archive using an algorithm this library predates.","commonSituations":"Archives made by very new WinRAR versions; single-bit corruption in a RAR4 method byte turning 0x35 into something > 0x35.","solutions":["Verify with `unrar t`; if valid, the archive needs a newer extractor — use official unrar or upgrade this library","Re-create the archive with standard RAR5 compression (-ma5 -m1..-m5)","If corruption is suspected, re-download/re-copy the file"],"exampleFix":"// before: rar a -ma7 files/ -> method 6-7, unsupported\n// after:  rar a -ma5 -m3 files/ -> methods 1-5, supported","handlingStrategy":"try-catch","validationCode":"const unsupported = records.filter(r => r.method > 5);\nif (unsupported.length) {\n  throw new Error(`Archive needs a newer extractor (methods: ${unsupported.map(r => r.path).join(', ')})`);\n}","typeGuard":"function usesSupportedMethod(record: { method: number }): boolean {\n  return record.method >= 0 && record.method <= 5;\n}","tryCatchPattern":"try {\n  const bytes = await reader.read(memberPath);\n} catch (err) {\n  if (err instanceof ArchiveError && /Unsupported RAR[45]? compression method/.test(err.message)) {\n    // delegate to system unrar binary or request a repacked archive\n  }\n  throw err;\n}","preventionTips":["Create archives with standard RAR5 methods (-ma5 -m1..-m5), not RAR7/new formats","Pre-validate record.method from the index before attempting extraction","Keep the extraction library current so newly supported methods are picked up"],"tags":["rar","archive","unsupported-method","compression"],"backgroundTag":"unsupported-archive-compression-version","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}