vxcontrol/pentagi · error

reading uploads cache: %w

Error message

reading uploads cache: %w

What it means

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.

Source

Thrown at backend/pkg/flowfiles/files.go:59

	IsDir      bool
	ModifiedAt time.Time
}

type Files struct {
	Files []File
	Total uint64
}

// TarEntry describes a local regular file to include in a TAR archive.
type TarEntry struct {
	LocalPath string
	TarPath   string
}

func List(dataDir string, flowID uint64) (Files, error) {
	uploadsEntries, err := ListDirEntries(FlowUploadsDir(dataDir, flowID), UploadsDirName)
	if err != nil {
		return Files{}, fmt.Errorf("reading uploads cache: %w", err)
	}

	containerEntries, err := ListDirEntriesRecursive(FlowContainerDir(dataDir, flowID), ContainerDirName)
	if err != nil {
		return Files{}, fmt.Errorf("reading container cache: %w", err)
	}

	resourcesEntries, err := ListDirEntriesRecursive(FlowResourcesDir(dataDir, flowID), ResourcesDirName)
	if err != nil {
		return Files{}, fmt.Errorf("reading resources cache: %w", err)
	}

	files := append(uploadsEntries, containerEntries...)
	files = append(files, resourcesEntries...)
	Sort(files)
	return Files{
		Files: files,
		Total: uint64(len(files)),

View on GitHub (pinned to ea665308ba)

Solutions

  1. Ensure the uploads directory exists before calling List, or make ListDirEntries tolerate os.ErrNotExist
  2. Check directory permissions and that the process user can read it
  3. Verify the data volume is mounted and writable at dataDir
  4. Confirm the flowID is valid and its data directory was created

Example fix

// before
if err != nil {
    return Files{}, fmt.Errorf("reading uploads cache: %w", err)
}
// after
if err != nil {
    if os.IsNotExist(err) {
        uploadsEntries = nil // fresh flow, nothing uploaded yet
    } else {
        return Files{}, fmt.Errorf("reading uploads cache: %w", err)
    }
}
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(files.FlowUploadsDir(dataDir, flowID)); err != nil {
    if os.IsNotExist(err) { os.MkdirAll(files.FlowUploadsDir(dataDir, flowID), 0o755) }
}

Type guard

func isMissingUploadsCache(err error) bool {
    return strings.Contains(err.Error(), "reading uploads cache") && errors.Is(err, os.ErrNotExist)
}

Try / catch

files, err := flowfiles.List(dataDir, flowID)
if err != nil && strings.Contains(err.Error(), "reading uploads cache") {
    if os.IsNotExist(err) { files = flowfiles.Files{} } else { return err }
}

Prevention

When it happens

Trigger: Calling flowfiles.List(dataDir, flowID) when the uploads directory doesn't exist yet, has wrong permissions, or ListDirEntries hits an OS-level readdir failure.

Common situations: 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.

Related errors


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/dab38d10dc2deaa5. Report an issue: GitHub.