nektos/act · error

GoGitActionCache failed to list files %s with sha %s subpath

Error message

GoGitActionCache failed to list files %s with sha %s subpath '%s' at %s: %w

What it means

GetTarArchive then calls commit.Files() to enumerate the tree's files. This wraps failure starting that file iterator — again object-store level: blobs/trees referenced by the commit are missing or unreadable in the bare cache repo (shallow/partial/corrupt object database).

Source

Thrown at pkg/runner/action_cache.go:151

	gitPath := path.Join(c.Path, safeFilename(cacheDir)+".git")

	logger.Infof("GoGitActionCache get content %s with sha %s subpath '%s' at %s", cacheDir, sha, includePrefix, gitPath)

	gogitrepo, err := git.PlainOpen(gitPath)
	if err != nil {
		return nil, fmt.Errorf("GoGitActionCache failed to open bare git %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err)
	}
	commit, err := gogitrepo.CommitObject(plumbing.NewHash(sha))
	if err != nil {
		return nil, fmt.Errorf("GoGitActionCache failed to get commit %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err)
	}
	t, err := commit.Tree()
	if err != nil {
		return nil, fmt.Errorf("GoGitActionCache failed to open git tree %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err)
	}
	files, err := commit.Files()
	if err != nil {
		return nil, fmt.Errorf("GoGitActionCache failed to list files %s with sha %s subpath '%s' at %s: %w", cacheDir, sha, includePrefix, gitPath, err)
	}
	rpipe, wpipe := io.Pipe()
	// Interrupt io.Copy using ctx
	ch := make(chan int, 1)
	go func() {
		select {
		case <-ctx.Done():
			wpipe.CloseWithError(ctx.Err())
		case <-ch:
		}
	}()
	go func() {
		defer wpipe.Close()
		defer close(ch)
		tw := tar.NewWriter(wpipe)
		cleanIncludePrefix := path.Clean(includePrefix)
		wpipe.CloseWithError(files.ForEach(func(f *object.File) error {
			return actionCacheCopyFileOrDir(ctx, cleanIncludePrefix, t, tw, f.Name, f)

View on GitHub (pinned to 4f41128141)

Solutions

  1. Delete and rebuild the cache: rm -rf <gitPath> (or all of ~/.cache/act) and re-run.
  2. Fix ownership/permissions of the cache tree: chown -R $(id -u):$(id -g) ~/.cache/act.
  3. Ensure the fetch phase completes without interruption (avoid Ctrl-C during 'fetching' log lines).
  4. Use a fresh --action-cache-path if the old path is on flaky storage.

Example fix

# before
act  # failed to list files ... object not found

# after
rm -rf ~/.cache/act && act
Defensive patterns

Strategy: fallback

Validate before calling

git --git-dir="$HOME/.cache/act/<cache-name>.git" fsck 2>&1 | grep -q 'missing\|corrupt' && rm -rf "$HOME/.cache/act/<cache-name>.git"

Prevention

When it happens

Trigger: Same class as the tree error but hit while walking nested subtrees: a subdirectory tree object absent from the depth=1 fetch, corrupt packfile, or permission error reading objects/ under the cache path.

Common situations: Interrupted fetch; permissions changed on ~/.cache/act (different user later runs act); cache migrated between machines/filesystems with lost files.

Related errors


AI-assisted analysis of nektos/act@4f41128141 (2026-08-15). Data as JSON: /api/errors/aff8be6769bae27d. Report an issue: GitHub.