What Does Unrar Exit Code 3 Mean?

When working with RAR archives via the command line, encountering Unrar exit code 3 indicates a CRC (Cyclic Redundancy Check) error. This exit code means that the unrar utility successfully opened the archive, but the extracted files failed data verification, indicating that the files inside are corrupt, incomplete, or were decrypted with an invalid password. This guide explains the exact mechanics behind this error, its primary causes, and how to resolve it.

The Meaning of Exit Code 3

A Cyclic Redundancy Check (CRC) is an error-detecting code used during compression to ensure data integrity. When an archive is created, a CRC value is calculated for each file and stored in the archive headers. During extraction, unrar calculates the CRC value of the extracted data and compares it against the stored value.

If the two checksums do not match, unrar flags the operation as compromised and terminates with exit code 3. This safety mechanism prevents you from using partially damaged or invalid files without warning.

Common Causes

  1. Incomplete or Damaged Downloads: The most frequent cause is a download that was interrupted or corrupted during network transit, leaving missing bits inside the archive.
  2. Incorrect Decryption Password: If an archive uses encrypted file data rather than encrypted file headers, unrar may attempt to unpack the files using an incorrect password. Because symmetric encryption with the wrong key yields pseudo-random garbage data, the resulting checksum fails, throwing exit code 3.
  3. Storage or Media Errors: Bad sectors on hard drives, failing flash storage, or faulty RAM can alter bits of the archive either while stored on disk or while loaded into memory.
  4. Multipart Archive Desynchronization: In split archives (e.g., .part1.rar, .part2.rar), if one part is from an older or modified version, the overall extraction will fail with a CRC mismatch.

How to Resolve Unrar Exit Code 3

  • Verify the Password: If the archive is password-protected, verify that the password provided to the -p switch is correct.
  • Redownload the Archive: If the archive was fetched over the internet, obtain a fresh copy. When available, compare the MD5 or SHA-256 hash of your downloaded file against the source file.
  • Attempt Archive Repair: If the original archive included recovery records, you can attempt to repair it using the r command:
    rar r archive_name.rar
    This creates a fixed.archive_name.rar file that can often reconstruct damaged data blocks.
  • Force Extraction (Ignore Broken Files): If the data cannot be repaired but you still need access to whatever partial data exists, use the -kb (Keep Broken extracted files) flag:
    unrar x -kb archive_name.rar
    While this still logs exit code 3, it prevents unrar from automatically deleting the damaged files after extraction.