nektos/act · error

GoGitActionCache failed to resolve sha %s with ref %s at %s:

Error message

GoGitActionCache failed to resolve sha %s with ref %s at %s: %w

What it means

After a successful fetch into the temporary branch, Fetch resolves the branch head with ResolveRevision(plumbing.Revision(branchName)). This error means the fetched refspec produced no resolvable commit on that branch — typically because the refspec source was empty/dangling (e.g. fetching an empty repo's HEAD) or the packed-refs state is inconsistent in the bare cache.

Source

Thrown at pkg/runner/action_cache.go:86

	if err != nil {
		return "", fmt.Errorf("GoGitActionCache failed to create remote %s with ref %s at %s: %w", url, ref, gitPath, err)
	}
	defer func() {
		_ = gogitrepo.DeleteBranch(branchName)
	}()
	if err := remote.FetchContext(ctx, &git.FetchOptions{
		RefSpecs: []config.RefSpec{
			config.RefSpec(ref + ":" + branchName),
		},
		Auth:  auth,
		Force: true,
		Depth: 1,
	}); err != nil {
		return "", fmt.Errorf("GoGitActionCache failed to fetch %s with ref %s at %s: %w", url, ref, gitPath, err)
	}
	hash, err := gogitrepo.ResolveRevision(plumbing.Revision(branchName))
	if err != nil {
		return "", fmt.Errorf("GoGitActionCache failed to resolve sha %s with ref %s at %s: %w", url, ref, gitPath, err)
	}
	logger.Infof("GoGitActionCache fetch %s with ref %s at %s resolved to %s", url, ref, gitPath, hash.String())
	return hash.String(), nil
}

type GitFileInfo struct {
	name    string
	size    int64
	modTime time.Time
	isDir   bool
	mode    fs.FileMode
}

// IsDir implements fs.FileInfo.
func (g *GitFileInfo) IsDir() bool {
	return g.isDir
}

View on GitHub (pinned to 4f41128141)

Solutions

  1. Delete the bare cache repo printed in the error (rm -rf <gitPath>) so it is recreated from scratch.
  2. Pin 'uses:' to an existing branch/tag (e.g. @v4, @main) instead of a raw sha you are not sure is reachable.
  3. Confirm the repo's default branch still exists and contains the action.
  4. Avoid running multiple act instances concurrently against the same --action-cache-path.

Example fix

# before
uses: org/repo/.github/actions/deploy@4b2f6c1a...  # unreachable sha

# after
uses: org/repo/.github/actions/deploy@v2
Defensive patterns

Strategy: fallback

Validate before calling

git ls-remote https://github.com/{owner}/{repo} | grep -E "(refs/(heads|tags)/)?<ref>" || echo 'ref missing'

Prevention

When it happens

Trigger: The resolved 'ref' argument (e.g. 'refs/heads/main' for a repo whose default branch no longer exists, or a sha-style ref for 'uses: repo@<sha>') fetched zero objects so the tmp branch has no target; or corrupt refs in the shared bare cache after an interrupted fetch.

Common situations: Action repo's default branch renamed (master→main) while act cached old metadata; 'uses: org/repo@<full-sha>' where the sha is unreachable in the shallow fetch; two act processes racing on the same cache dir.

Related errors


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