{"record":{"id":"dab38d10dc2deaa5","repo":"vxcontrol/pentagi","slug":"reading-uploads-cache-w","errorCode":null,"errorMessage":"reading uploads cache: %w","messagePattern":"reading uploads cache: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/flowfiles/files.go","lineNumber":59,"sourceCode":"\tIsDir      bool\n\tModifiedAt time.Time\n}\n\ntype Files struct {\n\tFiles []File\n\tTotal uint64\n}\n\n// TarEntry describes a local regular file to include in a TAR archive.\ntype TarEntry struct {\n\tLocalPath string\n\tTarPath   string\n}\n\nfunc List(dataDir string, flowID uint64) (Files, error) {\n\tuploadsEntries, err := ListDirEntries(FlowUploadsDir(dataDir, flowID), UploadsDirName)\n\tif err != nil {\n\t\treturn Files{}, fmt.Errorf(\"reading uploads cache: %w\", err)\n\t}\n\n\tcontainerEntries, err := ListDirEntriesRecursive(FlowContainerDir(dataDir, flowID), ContainerDirName)\n\tif err != nil {\n\t\treturn Files{}, fmt.Errorf(\"reading container cache: %w\", err)\n\t}\n\n\tresourcesEntries, err := ListDirEntriesRecursive(FlowResourcesDir(dataDir, flowID), ResourcesDirName)\n\tif err != nil {\n\t\treturn Files{}, fmt.Errorf(\"reading resources cache: %w\", err)\n\t}\n\n\tfiles := append(uploadsEntries, containerEntries...)\n\tfiles = append(files, resourcesEntries...)\n\tSort(files)\n\treturn Files{\n\t\tFiles: files,\n\t\tTotal: uint64(len(files)),","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/flowfiles/files.go#L41-L77","documentation":"List() aggregates flow files from several on-disk cache directories; this error wraps a failure reading the per-flow uploads directory (ListDirEntries on FlowUploadsDir). It means the uploads cache directory could not be read.","triggerScenarios":"Calling flowfiles.List(dataDir, flowID) when the uploads directory doesn't exist yet, has wrong permissions, or ListDirEntries hits an OS-level readdir failure.","commonSituations":"Flow created but no files uploaded yet and the directory was never created; data volume not mounted or remounted read-only; permissions changed by container user mismatch; flowID pointing to a deleted flow.","solutions":["Ensure the uploads directory exists before calling List, or make ListDirEntries tolerate os.ErrNotExist","Check directory permissions and that the process user can read it","Verify the data volume is mounted and writable at dataDir","Confirm the flowID is valid and its data directory was created"],"exampleFix":"// before\nif err != nil {\n    return Files{}, fmt.Errorf(\"reading uploads cache: %w\", err)\n}\n// after\nif err != nil {\n    if os.IsNotExist(err) {\n        uploadsEntries = nil // fresh flow, nothing uploaded yet\n    } else {\n        return Files{}, fmt.Errorf(\"reading uploads cache: %w\", err)\n    }\n}","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(files.FlowUploadsDir(dataDir, flowID)); err != nil {\n    if os.IsNotExist(err) { os.MkdirAll(files.FlowUploadsDir(dataDir, flowID), 0o755) }\n}","typeGuard":"func isMissingUploadsCache(err error) bool {\n    return strings.Contains(err.Error(), \"reading uploads cache\") && errors.Is(err, os.ErrNotExist)\n}","tryCatchPattern":"files, err := flowfiles.List(dataDir, flowID)\nif err != nil && strings.Contains(err.Error(), \"reading uploads cache\") {\n    if os.IsNotExist(err) { files = flowfiles.Files{} } else { return err }\n}","preventionTips":["Create all flow cache directories at flow creation time","Ensure the data volume is mounted and writable before serving requests","Run the process as a user with consistent ownership of the data dir","Verify flowID validity before touching its data directory"],"tags":["filesystem","flowfiles","directory"],"backgroundTag":"directory-read-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}