How to Fix Unrar Exit Code 9

Unrar exit code 9 indicates a "File Create Error," which occurs when the extraction utility is unable to create a file or directory on the destination storage. This guide covers why this error code triggers during automated scripts or command-line operations and provides direct, actionable solutions to resolve file creation failures during extraction.

What Unrar Exit Code 9 Means

Command-line utilities use exit codes (return codes) to report the outcome of a command to the operating system or calling script. In the official RAR and UnRAR return code specification, Exit Code 9 is strictly defined as a Create Error. This means that Unrar successfully read the archive headers, but failed at the system level when attempting to initialize or write a new file or directory at the specified destination path.

Common Causes

  1. Insufficient Write Permissions
    The user executing the unrar command does not have permission to write to the destination directory.

  2. File Path or Name Restrictions
    The archive contains filenames with reserved characters (such as :, ?, *, <, > on Windows) or the target path exceeds the operating system's maximum path length limit (e.g., the 260-character limit on legacy Windows paths).

  3. Read-Only Filesystem
    The destination drive, network share, or partition is mounted as read-only.

  4. Directory Structure Missing
    The extraction command attempts to write to a target path structure that does not exist, and the current Unrar flags prevent or fail at auto-creating parent directories.

  5. Exhausted Inodes or Storage Space
    While write errors often trigger exit code 5, a storage device completely out of inodes (on Linux/Unix) will fail at the creation step, triggering code 9.

How to Resolve the Error

1. Verify Destination Permissions

Ensure the account running the extraction process has full write access to the output directory.

  • On Linux/macOS:
    chmod -R u+w /path/to/destination
    chown -R your_user:your_group /path/to/destination
  • On Windows, verify that the current shell or automation service account has "Write" and "Modify" NTFS permissions for the destination folder.

2. Test with an Absolute Destination Path

Explicitly supply an absolute path with a trailing slash to prevent ambiguous directory lookups:

unrar x archive.rar /absolute/path/to/destination/

3. Handle Long Paths and Invalid Filenames

If the archive originated from a different operating system:

  • Enable long path support in the Windows Registry (LongPathsEnabled set to 1 in HKLM\SYSTEM\CurrentControlSet\Control\FileSystem).
  • Extract files to a shorter root folder (e.g., C:\temp\).
  • Use the -ep switch to exclude internal path structures if the nested folder tree is causing path-length overflow:
    unrar e archive.rar /destination/

4. Confirm Filesystem Status

Check whether the target storage device has remaining capacity and is mounted with write capabilities:

  • On Linux, run df -h to verify available disk space and df -i to verify available inodes.
  • Check mount attributes with mount | grep <device> to confirm it is mounted rw (read-write) rather than ro (read-only).