nektos/act · error

GoGitActionCache failed to open bare git %s with sha %s subp

Error message

GoGitActionCache failed to open bare git %s with sha %s subpath '%s' at %s: %w

What it means

GetTarArchive opens the previously created bare cache repo with git.PlainOpen(gitPath) to stream the action's files as a tar. This error wraps failure to open that bare repo: it does not exist (Fetch never ran or cache was wiped between fetch and materialize) or the directory exists but is not a valid git repository.

Source

Thrown at pkg/runner/action_cache.go:139

func (g *GitFileInfo) Size() int64 {
	return g.size
}

// Sys implements fs.FileInfo.
func (g *GitFileInfo) Sys() any {
	return nil
}

func (c GoGitActionCache) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error) {
	logger := common.Logger(ctx)

	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 {

View on GitHub (pinned to 4f41128141)

Solutions

  1. Re-run the job after clearing the cache entirely: rm -rf ~/.cache/act (stale state is rebuilt).
  2. Give each concurrent act run its own cache: act --action-cache-path /tmp/cache-$$ per instance.
  3. Exclude the act cache dir from disk-cleanup jobs (nohup scripts, Docker image prunes touching volumes).
  4. Verify the printed gitPath exists and contains HEAD/config/objects after a run: ls <gitPath>.

Example fix

# before
rm -rf ~/.cache/act & act -j build   # racing cleanup

# after
act --action-cache-path /tmp/act-cache-a -j build   # isolated cache per run
Defensive patterns

Strategy: validation

Validate before calling

for d in "$HOME/.cache/act"/*.git; do git --git-dir="$d" rev-parse --is-bare-repository >/dev/null 2>&1 || echo "corrupt cache repo: $d"; done

Prevention

When it happens

Trigger: The *.git cache directory was deleted (concurrent 'rm -rf ~/.cache/act', another act run cleaning up) between the Fetch phase and GetTarArchive; or a partial/corrupt directory is present so PlainOpen fails with repository does not exist.

Common situations: Two act processes sharing one cache path with one pruning it; disk-cleanup cron jobs removing the cache mid-run; a previously crashed run leaving a directory without a valid HEAD/objects layout.

Related errors


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