{"record":{"id":"708e8e261fd54546","repo":"Billionmail/BillionMail","slug":"unrar-extraction-failed-s-s","errorCode":null,"errorMessage":"unrar extraction failed: %s - %s","messagePattern":"unrar extraction failed: (.+?) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/compress/rar.go","lineNumber":257,"sourceCode":"\t}\n\n\tdstAbs, err := filepath.Abs(dst)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// ensure destination directory exists\n\tif err := os.MkdirAll(dstAbs, 0755); err != nil {\n\t\treturn err\n\t}\n\n\t// use extract command with full path\n\tcmd := exec.Command(\"unrar\", \"x\", \"-o+\", srcAbs, dstAbs)\n\n\t// run command\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unrar extraction failed: %s - %s\", err, string(output))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":239,"sourceCodeEnd":262,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/compress/rar.go#L239-L262","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncmd := exec.Command(\"unrar\", \"x\", \"-o+\", srcAbs, dstAbs)\n// after (with password support)\ncmd := exec.Command(\"unrar\", \"x\", \"-o+\", \"-p\"+password, srcAbs, dstAbs)\n// and validate archive beforehand:\nerr := exec.Command(\"unrar\", \"t\", srcAbs).Run() // integrity test","handlingStrategy":"validation","validationCode":"if err := exec.Command(\"unrar\", \"t\", src).Run(); err != nil {\n\treturn fmt.Errorf(\"archive failed integrity test: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := UnrarWithExternalCommand(src, dst); err != nil {\n\tif strings.HasPrefix(err.Error(), \"unrar extraction failed:\") {\n\t\tlog.Printf(\"unrar reported: %v\", err) // CLI diagnostics follow the dash\n\t}\n}","preventionTips":["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"],"tags":["go","compression","rar","external-command","process-exit-error"],"backgroundTag":"external-command-failed","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}