yorukot/superfile · error

source path does not exist: %s

Error message

source path does not exist: %s

What it means

validateCompressOperation rejects a zip request when one of the requested sources does not exist on disk. os.Stat returned an fs.ErrNotExist for that path, so no compression is started and 0 files are counted.

Source

Thrown at src/internal/file_operations_compress.go:25

	"io"
	"log/slog"
	"os"
	"path/filepath"
	"strings"
	"time"

	tea "charm.land/bubbletea/v2"

	"github.com/yorukot/superfile/src/internal/ui/notify"
	"github.com/yorukot/superfile/src/internal/ui/processbar"
)

func validateCompressOperation(sources []string) (int, error) {
	totalFiles := 0
	for _, src := range sources {
		stat, err := os.Stat(src)
		if os.IsNotExist(err) {
			return 0, fmt.Errorf("source path does not exist: %s", src)
		}
		if err != nil {
			return 0, fmt.Errorf("cannot access source path %s: %w", src, err)
		}
		if !stat.IsDir() {
			if err = checkFileReadable(src); err != nil {
				slog.Error("the file is not readable", "error", err)
				return 0, fmt.Errorf("the file is not readable: %s", err.Error())
			}
		}
		count, err := countReadableFiles(src)
		if err != nil {
			slog.Error("Error while zip file count files ", "error", err)
			return 0, fmt.Errorf("error while counting files for %s: %s", src, err.Error())
		}
		totalFiles += count
	}
	return totalFiles, nil

View on GitHub (pinned to b72f550bc6)

Solutions

  1. Verify the path with ls / os.Stat and fix the typo or stale path in the sources list.
  2. Refresh the file selection so removed entries are dropped before compressing.
  3. Filter sources with os.Stat before calling, skipping entries that don't exist.
  4. Re-run the operation after the file is restored or recreated.

Example fix

// before
err := ops.ZipSources(sources, target)
// after
var valid []string
for _, s := range sources {
    if _, err := os.Stat(s); err == nil {
        valid = append(valid, s)
    }
}
if len(valid) == 0 {
    return fmt.Errorf("no valid sources to compress")
}
return ops.ZipSources(valid, target)
Defensive patterns

Strategy: validation

Validate before calling

var valid []string
for _, s := range sources {
    if _, err := os.Stat(s); err == nil {
        valid = append(valid, s)
    }
}
if len(valid) == 0 {
    return fmt.Errorf("no existing sources selected")
}

Try / catch

if err := ops.ZipSources(sources, target); err != nil {
    if strings.Contains(err.Error(), "source path does not exist") {
        // refresh selection and retry with valid paths
    }
    return err
}

Prevention

When it happens

Trigger: Calling zipSources/validateCompressOperation with a source path that was deleted, renamed, or mistyped after being added to the selection list.

Common situations: Stale selection UI holding paths that no longer exist; typos in manually-entered paths; files removed by cleanup scripts between selection and compression.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of yorukot/superfile@b72f550bc6 (2026-09-01). Data as JSON: /api/errors/53542c5911289ede. Report an issue: GitHub.