vxcontrol/pentagi · error

reading container cache: %w

Error message

reading container cache: %w

What it means

Same aggregation flow as the uploads variant: List() fails while recursively listing the per-flow container directory (ListDirEntriesRecursive on FlowContainerDir). The OS error is wrapped and returned to the caller.

Source

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

	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)),
	}, nil
}

func FlowDataDir(dataDir string, flowID uint64) string {
	return filepath.Join(dataDir, fmt.Sprintf("flow-%d-data", flowID))

View on GitHub (pinned to ea665308ba)

Solutions

  1. Ensure the container cache directory is created when the flow/container starts
  2. Treat os.ErrNotExist as an empty result if an empty cache is a valid state
  3. Check recursive-read permissions on FlowContainerDir(dataDir, flowID)
  4. Verify the data volume mount for the container-facing cache

Example fix

// before
return Files{}, fmt.Errorf("reading container cache: %w", err)
// after
if os.IsNotExist(err) {
    containerEntries = nil
} else {
    return Files{}, fmt.Errorf("reading container cache: %w", err)
}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: List(dataDir, flowID) with a container-dir that is missing, unreadable, or a symlink loop / permission problem encountered during recursion.

Common situations: Container file cache never populated for the flow; Docker container writes failed silently so the cache dir wasn't created; volume permission drift; partially deleted flow data.

Related errors


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