{"record":{"id":"6293c3e75f8b8ee5","repo":"yorukot/superfile","slug":"the-file-is-not-readable-s","errorCode":null,"errorMessage":"the file is not readable: %s","messagePattern":"the file is not readable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/internal/file_operations_compress.go","lineNumber":33,"sourceCode":"\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\n}\n\nfunc (m *model) getCompressSelectedFilesCmd() tea.Cmd {\n\tpanel := m.getFocusedFilePanel()\n\n\tif panel.Empty() {\n\t\treturn nil\n\t}","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/yorukot/superfile/blob/b72f550bc6e75913f48eb49fdd258e1a2df2fe88/src/internal/file_operations_compress.go#L15-L51","documentation":"validateCompressOperation found a non-directory source file that fails the checkFileReadable test, meaning it cannot be opened for reading (unreadable permissions or a special file that can't be read like a named pipe opened exclusively). The compression is aborted.","triggerScenarios":"A source in the list is a regular file with no read permission bit for the current user (e.g. mode 000, or owned by root), or a special file checkFileReadable rejects.","commonSituations":"Selecting files created by another user/root with restrictive modes; files with ACLs blocking read; sockets/pipes accidentally included in a selection.","solutions":["Check the file mode (ls -l) and grant read access: chmod u+r <file>.","Remove unreadable or special files from the selection list before compressing.","If the file should be readable, fix ownership: sudo chown <user> <file>.","Verify with a pre-flight read test (os.OpenFile(path, O_RDONLY, 0)) before calling the library."],"exampleFix":"// before\nsources = append(sources, newPath)\n// after\nf, err := os.OpenFile(newPath, os.O_RDONLY, 0)\nif err != nil {\n    slog.Warn(\"skipping unreadable source\", \"path\", newPath, \"err\", err)\n} else {\n    f.Close()\n    sources = append(sources, newPath)\n}","handlingStrategy":"validation","validationCode":"f, err := os.OpenFile(src, os.O_RDONLY, 0)\nif err != nil {\n    return fmt.Errorf(\"skipping unreadable file %s: %w\", src, err)\n}\nf.Close()","typeGuard":null,"tryCatchPattern":"if err := ops.ZipSources(sources, target); err != nil {\n    if strings.Contains(err.Error(), \"not readable\") {\n        // drop that file from the list or fix its permissions, then retry\n    }\n    return err\n}","preventionTips":["Grant read permission (chmod u+r) on files you intend to zip.","Exclude sockets/pipes and other special files from selections.","Avoid selecting files owned by other users without read access."],"tags":["go","filesystem","permissions","compress"],"backgroundTag":"file-not-readable","analyzedSha":"b72f550bc6e75913f48eb49fdd258e1a2df2fe88","analyzedAt":"2026-09-01T04:38:08.254Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}