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
- Inspect the unrar output embedded in the error to get the exact failure cause
- Supply the password if the archive is protected (unrar supports -p<password>; this wrapper may need extending to pass it)
- Update unrar to a current version supporting RAR5
- Re-download/re-generate the archive if it is corrupt or truncated (verify checksums)
- 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
- Run `unrar t` on the archive before extraction to catch corruption early
- Verify checksums on downloaded/uploaded archives
- Keep unrar updated for RAR5 compatibility
- Ensure destination has write permission and enough free space
- Handle password-protected archives explicitly rather than letting the CLI fail
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
- rar compression failed: %s - %s
- rar file was not created successfully
- disk quota exceeded
- illegal file path:
- rar command not found, please install it first
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/708e8e261fd54546.
Report an issue: GitHub.