Billionmail/BillionMail · error
source file/directory does not exist: %s
Error message
source file/directory does not exist: %s
What it means
Before adding each source to the rar command's argument list, Compress stats the absolute source path. If os.Stat fails (missing file/directory or a permission error surfaced as ENOENT), it reports the original source string in this error and aborts the whole compression.
Source
Thrown at core/internal/service/compress/rar.go:190
return err
}
// prepare command arguments
args := []string{"a", "-ep1", "-r"}
// add destination file
args = append(args, dstAbs)
// validate each source and add it to command
for _, src := range srcList {
srcAbs, err := filepath.Abs(src)
if err != nil {
return err
}
// make sure source exists
if _, err := os.Stat(srcAbs); err != nil {
return fmt.Errorf("source file/directory does not exist: %s", src)
}
// add source to arguments
args = append(args, srcAbs)
}
// create command
cmd := exec.Command("rar", args...)
// run command
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("rar compression failed: %s - %s", err, string(output))
}
// verify the file was created
if _, err := os.Stat(dstAbs); err != nil {
return errors.New("rar file was not created successfully")View on GitHub (pinned to fc36c76c05)
Solutions
- Check each source exists with os.Stat before calling Compress and fix/omit missing entries
- Use absolute paths (filepath.Abs) instead of relying on the process working directory
- Verify symlinks resolve to existing targets
- Fix path casing/encoding if the archive job runs on a case-sensitive filesystem
Example fix
// before
err := r.Compress("out.rar", "logs/app.log") // cwd differs in service
// after
src, _ := filepath.Abs("logs/app.log")
if _, err := os.Stat(src); err != nil { log.Fatal(err) }
err := r.Compress("out.rar", src) Defensive patterns
Strategy: validation
Validate before calling
for _, src := range srcList {
abs, err := filepath.Abs(src)
if err != nil { return err }
if _, err := os.Stat(abs); err != nil {
return fmt.Errorf("source missing: %s", src)
}
} Try / catch
if err := r.Compress(dst, srcList...); err != nil {
var missing string
if _, e := fmt.Sscanf(err.Error(), "source file/directory does not exist: %s", &missing); e == nil {
log.Printf("skipping job, missing source: %s", missing)
}
} Prevention
- os.Stat every source before scheduling compression
- Use absolute paths; do not depend on process cwd
- Resolve and verify symlinks before archiving
- Re-list source files immediately before the job to avoid races with cleanup
When it happens
Trigger: Calling RarUnpacker.Compress(dst, srcList...) where any entry in srcList does not exist at the given path — typo'd path, file deleted between listing and compression, wrong working directory for a relative path, or a symlink to a missing target.
Common situations: Relative paths used with a different cwd in a daemon vs. shell; temp files cleaned up before compression; case-sensitivity mismatch (Windows-built path on Linux).
Related errors
- rar file was not created successfully
- disk quota exceeded
- illegal file path:
- rar command not found, please install it first
- rar compression failed: %s - %s
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/6d8ea03e9f2fc47a.
Report an issue: GitHub.