can1357/oh-my-pi · error · ArchiveError

RAR member '${record.path}' CRC32 mismatch

Error message

RAR member '${record.path}' CRC32 mismatch

What it means

Each RAR member stores a CRC32 of its uncompressed content. After decoding, #decode recomputes CRC32 over the output and throws when it differs from the header value — proof that the decompressed bytes do not match what the archiver originally stored.

Source

Thrown at packages/utils/src/ar/rar.ts:137

				output = rar5Decoder.decode(
					packed,
					record.unpackedSize,
					record.dictionarySize,
					record.solid,
					record.version,
				);
			} else {
				output = rar4Decoder.decode(
					packed,
					record.unpackedSize,
					record.dictionarySize,
					record.solid,
					record.version,
				);
			}
			if (output.byteLength !== record.unpackedSize) corrupt(`member '${record.path}' size mismatch`);
			if (record.crc !== undefined && crc32(output) !== record.crc) {
				throw new ArchiveError(`RAR member '${record.path}' CRC32 mismatch`);
			}
			this.#cache.set(current, output.slice());
		}
	}
}

/** Probe the RAR 1.5-4.x or RAR5 signature. */
export function sniffRar(bytes: Uint8Array): boolean {
	return findMarker(bytes) !== undefined;
}

/** Index a RAR4 or RAR5 archive and defer member decompression until extraction. */
export const readRar: FormatReader = async (source, options) => {
	if (!Number.isSafeInteger(source.size) || source.size < 0) {
		throw new ArchiveError("Archive is too large to read safely");
	}
	const indexed = await indexRarMetadata(source, options);
	const bytes = sparseBytes(source.size, indexed.segments);

View on GitHub (pinned to 9690622007)

Solutions

  1. Run `unrar t` to identify which members are bad and re-download/re-copy the archive
  2. Recover what you can: extract other members; use `unrar kb` (keep broken) only if the data is non-critical
  3. Check disk health (S.M.A.R.T.) if the archive is stored locally and repeatedly fails
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const bytes = await reader.read(memberPath);
} catch (err) {
  if (err instanceof ArchiveError && /CRC32 mismatch/.test(err.message)) {
    // data is corrupt: stop, don't persist these bytes; attempt re-download or unrar recovery
  }
  throw err;
}

Prevention

When it happens

Trigger: Decoding a member whose compressed data is damaged, whose decoder produced wrong bytes (e.g. unsupported filter silently mis-handled), or whose header CRC was altered.

Common situations: Failed downloads, bad sectors, interrupted transfers; multi-volume archives with a missing/mismatched part; archives transferred in text mode.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/123114da6e001d28. Report an issue: GitHub.