Billionmail/BillionMail · error

unrar extraction failed: %s - %s

Error message

unrar extraction failed: %s - %s

What it means

When the `unrar x -o+ <src> <dst>` process exits non-zero, UnrarWithExternalCommand wraps the exec error together with the CLI's combined stdout/stderr output in this error. The message surfaces the unrar tool's own diagnostics — bad password, corrupt archive, unsupported version, full disk, unwritable destination.

Source

Thrown at core/internal/service/compress/rar.go:257

	}

	dstAbs, err := filepath.Abs(dst)
	if err != nil {
		return err
	}

	// ensure destination directory exists
	if err := os.MkdirAll(dstAbs, 0755); err != nil {
		return err
	}

	// use extract command with full path
	cmd := exec.Command("unrar", "x", "-o+", srcAbs, dstAbs)

	// run command
	output, err := cmd.CombinedOutput()
	if err != nil {
		return fmt.Errorf("unrar extraction failed: %s - %s", err, string(output))
	}

	return nil
}

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Inspect the unrar output embedded in the error to get the exact failure cause
  2. Supply the password if the archive is protected (unrar supports -p<password>; this wrapper may need extending to pass it)
  3. Update unrar to a current version supporting RAR5
  4. Re-download/re-generate the archive if it is corrupt or truncated (verify checksums)
  5. Ensure the destination is writable and has enough free space

Example fix

// before
cmd := exec.Command("unrar", "x", "-o+", srcAbs, dstAbs)
// after (with password support)
cmd := exec.Command("unrar", "x", "-o+", "-p"+password, srcAbs, dstAbs)
// and validate archive beforehand:
err := exec.Command("unrar", "t", srcAbs).Run() // integrity test
Defensive patterns

Strategy: validation

Validate before calling

if err := exec.Command("unrar", "t", src).Run(); err != nil {
	return fmt.Errorf("archive failed integrity test: %w", err)
}

Try / catch

if err := UnrarWithExternalCommand(src, dst); err != nil {
	if strings.HasPrefix(err.Error(), "unrar extraction failed:") {
		log.Printf("unrar reported: %v", err) // CLI diagnostics follow the dash
	}
}

Prevention

When it happens

Trigger: Extraction fails inside unrar: wrong or missing password (archives created with -hp/-p), corrupted/truncated .rar, archive made by newer rar versions than unrar supports, destination not writable or no disk space.

Common situations: Partial uploads leaving truncated archives; RAR5 archives read by an old unrar build; password-protected corporate archives automated without the passphrase; read-only destination mounts.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/708e8e261fd54546. Report an issue: GitHub.