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
- Delete the bare cache repo printed in the error (rm -rf <gitPath>) so it is recreated from scratch.
- Pin 'uses:' to an existing branch/tag (e.g. @v4, @main) instead of a raw sha you are not sure is reachable.
- Confirm the repo's default branch still exists and contains the action.
- 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
- Pin uses: to tags or full shas rather than moving branch heads.
- Do not share one cache dir across concurrent act runs.
- Clear the bare *.git cache dir when a default branch was renamed.
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
- failed to identify reference (tag/branch) for the checked-ou
- GoGitActionCache failed to open bare git %s with ref %s at %
- GoGitActionCache failed to open bare git %s with sha %s subp
- GoGitActionCache failed to get commit %s with sha %s subpath
- GoGitActionCache failed to open git tree %s with sha %s subp
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/215a12f30551d695.
Report an issue: GitHub.