{"record":{"id":"53542c5911289ede","repo":"yorukot/superfile","slug":"source-path-does-not-exist-s","errorCode":null,"errorMessage":"source path does not exist: %s","messagePattern":"source path does not exist: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/internal/file_operations_compress.go","lineNumber":25,"sourceCode":"\t\"io\"\n\t\"log/slog\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"time\"\n\n\ttea \"charm.land/bubbletea/v2\"\n\n\t\"github.com/yorukot/superfile/src/internal/ui/notify\"\n\t\"github.com/yorukot/superfile/src/internal/ui/processbar\"\n)\n\nfunc validateCompressOperation(sources []string) (int, error) {\n\ttotalFiles := 0\n\tfor _, src := range sources {\n\t\tstat, err := os.Stat(src)\n\t\tif os.IsNotExist(err) {\n\t\t\treturn 0, fmt.Errorf(\"source path does not exist: %s\", src)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"cannot access source path %s: %w\", src, err)\n\t\t}\n\t\tif !stat.IsDir() {\n\t\t\tif err = checkFileReadable(src); err != nil {\n\t\t\t\tslog.Error(\"the file is not readable\", \"error\", err)\n\t\t\t\treturn 0, fmt.Errorf(\"the file is not readable: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t\tcount, err := countReadableFiles(src)\n\t\tif err != nil {\n\t\t\tslog.Error(\"Error while zip file count files \", \"error\", err)\n\t\t\treturn 0, fmt.Errorf(\"error while counting files for %s: %s\", src, err.Error())\n\t\t}\n\t\ttotalFiles += count\n\t}\n\treturn totalFiles, nil","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/yorukot/superfile/blob/b72f550bc6e75913f48eb49fdd258e1a2df2fe88/src/internal/file_operations_compress.go#L7-L43","documentation":"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.","triggerScenarios":"Calling zipSources/validateCompressOperation with a source path that was deleted, renamed, or mistyped after being added to the selection list.","commonSituations":"Stale selection UI holding paths that no longer exist; typos in manually-entered paths; files removed by cleanup scripts between selection and compression.","solutions":["Verify the path with ls / os.Stat and fix the typo or stale path in the sources list.","Refresh the file selection so removed entries are dropped before compressing.","Filter sources with os.Stat before calling, skipping entries that don't exist.","Re-run the operation after the file is restored or recreated."],"exampleFix":"// before\nerr := ops.ZipSources(sources, target)\n// after\nvar valid []string\nfor _, s := range sources {\n    if _, err := os.Stat(s); err == nil {\n        valid = append(valid, s)\n    }\n}\nif len(valid) == 0 {\n    return fmt.Errorf(\"no valid sources to compress\")\n}\nreturn ops.ZipSources(valid, target)","handlingStrategy":"validation","validationCode":"var valid []string\nfor _, s := range sources {\n    if _, err := os.Stat(s); err == nil {\n        valid = append(valid, s)\n    }\n}\nif len(valid) == 0 {\n    return fmt.Errorf(\"no existing sources selected\")\n}","typeGuard":null,"tryCatchPattern":"if err := ops.ZipSources(sources, target); err != nil {\n    if strings.Contains(err.Error(), \"source path does not exist\") {\n        // refresh selection and retry with valid paths\n    }\n    return err\n}","preventionTips":["Refresh the file selection list before compressing.","Validate user-entered paths with os.Stat at input time.","Watch for external deletions (cleanup jobs) between select and compress."],"tags":["go","filesystem","validation","compress"],"backgroundTag":"file-not-found","analyzedSha":"b72f550bc6e75913f48eb49fdd258e1a2df2fe88","analyzedAt":"2026-09-01T04:38:08.254Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}