{"record":{"id":"15b8cc0c08b028c1","repo":"can1357/oh-my-pi","slug":"arj-member-memberpath-has-inconsistent-stored","errorCode":null,"errorMessage":"ARJ member '${memberPath}' has inconsistent stored size","messagePattern":"ARJ member '(.+?)' has inconsistent stored size","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/arj.ts","lineNumber":179,"sourceCode":"\treadonly #packedSize: number;\n\treadonly #method: number;\n\treadonly #crc: number;\n\n\tconstructor(archive: Uint8Array, start: number, packedSize: number, method: number, crc: number) {\n\t\tthis.#archive = archive;\n\t\tthis.#start = start;\n\t\tthis.#packedSize = packedSize;\n\t\tthis.#method = method;\n\t\tthis.#crc = crc;\n\t}\n\n\tasync read(size: number, memberPath: string): Promise<Uint8Array> {\n\t\tconst packed = this.#archive.subarray(this.#start, this.#start + this.#packedSize);\n\t\tlet output: Uint8Array;\n\t\tswitch (this.#method) {\n\t\t\tcase 0:\n\t\t\t\tif (packed.byteLength !== size)\n\t\t\t\t\tthrow new ArchiveError(`ARJ member '${memberPath}' has inconsistent stored size`);\n\t\t\t\toutput = packed.slice();\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\tcase 2:\n\t\t\tcase 3:\n\t\t\t\toutput = decompressLhStatic(packed, size, 26_624, 5, 17, `ARJ method ${this.#method}`);\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\toutput = decompressArjMethod4(packed, size);\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\tcase 9:\n\t\t\t\tif (size !== 0 || packed.byteLength !== 0) {\n\t\t\t\t\tthrow new ArchiveError(`ARJ member '${memberPath}' has invalid no-data method sizes`);\n\t\t\t\t}\n\t\t\t\toutput = new Uint8Array(0);\n\t\t\t\tbreak;\n\t\t\tdefault:","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/arj.ts#L161-L197","documentation":"This ArchiveError is thrown when an ARJ member declares compression method 0 (stored/uncompressed) but its packed byte range in the archive does not match the declared uncompressed size. The library validates that a stored member is a verbatim copy, so a mismatch means the archive's local header is corrupt or the member's packed/size fields disagree.","triggerScenarios":"Calling member.read(size, memberPath) (directly or via archive listing/extraction flows like readArj-driven decompression) on a stored (method 0) ARJ member whose packedSize from the local header differs from the size passed in.","commonSituations":"Corrupted or truncated archives, archives produced by non-conforming ARJ writers, files edited or patched in place, or archives assembled by concatenation where member headers were not updated.","solutions":["Verify the archive integrity (run arj t or re-download the archive) — the header size fields disagree.","Recreate the archive with a standards-compliant ARJ tool.","Catch ArchiveError and surface the specific memberPath to identify the offending member.","If the source is trusted, compare the member's packedSize and size header fields to confirm they match for method-0 members."],"exampleFix":"// before: blindly reading every member\nfor (const entry of entries) await entry.read(entry.size, entry.path);\n// after: skip/guard stored members with mismatched sizes\nfor (const entry of entries) {\n  try {\n    await entry.read(entry.size, entry.path);\n  } catch (e) {\n    if (e instanceof ArchiveError && e.message.includes('inconsistent stored size')) {\n      console.warn(`skipping corrupt stored member: ${entry.path}`);\n      continue;\n    }\n    throw e;\n  }\n}","handlingStrategy":"validation","validationCode":"if (member.packedSize !== member.size) {\n  throw new Error(`stored member ${member.path} has mismatched packed/unpacked sizes; archive likely corrupt`);\n}\nawait member.read(member.size, member.path);","typeGuard":"function isStoredMember(m: { method: number }): boolean {\n  return m.method === 0;\n}","tryCatchPattern":"try {\n  const data = await member.read(size, path);\n} catch (e) {\n  if (e instanceof ArchiveError && e.message.includes('inconsistent stored size')) {\n    // skip or report corrupt member\n  } else throw e;\n}","preventionTips":["Validate archives with the official arj tool before processing","Check that packedSize === size for method-0 members before reading","Re-download archives rather than attempting to salvage corrupt ones"],"tags":["archive","corruption","arj","data-integrity"],"backgroundTag":"archive-member-corrupt","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}