{"record":{"id":"18d090f7527b6aa2","repo":"can1357/oh-my-pi","slug":"unsupported-multi-volume-rar4-archive","errorCode":null,"errorMessage":"Unsupported multi-volume RAR4 archive","messagePattern":"Unsupported multi-volume RAR4 archive","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/rar.ts","lineNumber":478,"sourceCode":"\t\tconst headerCrc = readUInt16LE(bytes, offset);\n\t\tconst type = bytes[offset + 2]!;\n\t\tconst flags = readUInt16LE(bytes, offset + 3);\n\t\tconst headerSize = readUInt16LE(bytes, offset + 5);\n\t\tif (headerSize < 7) corrupt(\"invalid RAR4 header size\");\n\t\tassertIndexSize(headerSize, options.limits, \"RAR4 header\");\n\t\tconst headerEnd = checkedEnd(offset, headerSize, bytes.byteLength, \"RAR4 header\");\n\t\tif ((crc32(bytes.subarray(offset + 2, headerEnd)) & 0xffff) !== headerCrc) corrupt(\"RAR4 header CRC mismatch\");\n\t\tlet dataSize = 0;\n\t\tlet cursor = offset + 7;\n\t\tif ((flags & 0x8000) !== 0) {\n\t\t\tneed(cursor, 4, headerEnd, \"RAR4 additional size\");\n\t\t\tdataSize = readUInt32LE(bytes, cursor);\n\t\t\tcursor += 4;\n\t\t}\n\t\tconst dataStart = headerEnd;\n\t\tlet dataEnd = checkedEnd(dataStart, dataSize, bytes.byteLength, \"RAR4 data area\");\n\t\tif (type === 0x73) {\n\t\t\tif ((flags & 1) !== 0) throw new ArchiveError(\"Unsupported multi-volume RAR4 archive\");\n\t\t\tif ((flags & 0x40) !== 0) throw new ArchiveError(\"Unsupported RAR4 recovery record\");\n\t\t\tif ((flags & 0x80) !== 0) throw new ArchiveError(\"Encrypted RAR4 headers are not supported\");\n\t\t\tsawMain = true;\n\t\t} else if (type === 0x74) {\n\t\t\tneed(cursor, 21, headerEnd, \"RAR4 file header\");\n\t\t\tconst unpackedLow = readUInt32LE(bytes, cursor);\n\t\t\tcursor += 4;\n\t\t\tconst hostOs = bytes[cursor++]!;\n\t\t\tconst dataCrc = readUInt32LE(bytes, cursor);\n\t\t\tcursor += 4;\n\t\t\tconst dosTime = readUInt32LE(bytes, cursor);\n\t\t\tcursor += 4;\n\t\t\tconst version = bytes[cursor++]!;\n\t\t\tconst methodByte = bytes[cursor++]!;\n\t\t\tconst nameSize = readUInt16LE(bytes, cursor);\n\t\t\tcursor += 2;\n\t\t\tconst attributes = readUInt32LE(bytes, cursor);\n\t\t\tcursor += 4;","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/rar.ts#L460-L496","documentation":"In parseRar4, the main archive header (type 0x73) with flag bit 0 set marks a multi-volume (split) RAR4 archive. The library does not support volume sets, so it throws ArchiveError immediately at the main header. Each member's continuation lives in other volume files, which the parser cannot resolve.","triggerScenarios":"Calling records()/parseRar4() on a legacy .rar/.r00/.r01 volume set or the first volume of an old-style split archive.","commonSituations":"Old archives split to fit floppies/CDs or email limits; extracting only the .rar part without merging; automated pipelines fed a single volume.","solutions":["Extract the full volume set with an external tool (unrar/7-Zip) that supports volumes, then consume the extracted files.","Re-create the archive as a single volume without the -v flag.","Repackage contents as zip or tar before parsing with this library.","Catch ArchiveError, detect the multi-volume case, and surface a message asking for all volumes."],"exampleFix":"// before: feeding volume set\nawait records(Bun.file(\"old.rar\")) // part of .r00/.r01 set\n// after: repackage single-volume\n$`unrar x -y old.rar extracted/`","handlingStrategy":"try-catch","validationCode":"// RAR4 multi-volume main-header flag bit 0 — pre-scan after 7-byte marker\n// simplest: reject .rar files that have sibling .r00/.r01/.partN files\nimport { readdirSync } from \"node:fs\";\nconst siblings = readdirSync(dirname).filter(f => /\\.r\\d{2}$|\\.part\\d+\\.rar$/i.test(f));\nif (siblings.length) throw new Error(\"multi-volume set detected\");","typeGuard":null,"tryCatchPattern":"try {\n  const recs = await records(file);\n} catch (err) {\n  if (err instanceof ArchiveError && err.message.includes(\"multi-volume RAR4\")) {\n    // extract full set with unrar, then continue\n  } else throw err;\n}","preventionTips":["Check for .r00/.partN siblings before ingesting a .rar.","Request single-volume archives from producers.","Use external extraction for legacy volume sets.","Migrate archives to zip/tar at intake."],"tags":["archive","rar4","multi-volume","unsupported-feature"],"backgroundTag":"multi-volume-archive-unsupported","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}