{"record":{"id":"215a12f30551d695","repo":"nektos/act","slug":"gogitactioncache-failed-to-resolve-sha-s-with-ref","errorCode":null,"errorMessage":"GoGitActionCache failed to resolve sha %s with ref %s at %s: %w","messagePattern":"GoGitActionCache failed to resolve sha (.+?) with ref (.+?) at (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runner/action_cache.go","lineNumber":86,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"GoGitActionCache failed to create remote %s with ref %s at %s: %w\", url, ref, gitPath, err)\n\t}\n\tdefer func() {\n\t\t_ = gogitrepo.DeleteBranch(branchName)\n\t}()\n\tif err := remote.FetchContext(ctx, &git.FetchOptions{\n\t\tRefSpecs: []config.RefSpec{\n\t\t\tconfig.RefSpec(ref + \":\" + branchName),\n\t\t},\n\t\tAuth:  auth,\n\t\tForce: true,\n\t\tDepth: 1,\n\t}); err != nil {\n\t\treturn \"\", fmt.Errorf(\"GoGitActionCache failed to fetch %s with ref %s at %s: %w\", url, ref, gitPath, err)\n\t}\n\thash, err := gogitrepo.ResolveRevision(plumbing.Revision(branchName))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"GoGitActionCache failed to resolve sha %s with ref %s at %s: %w\", url, ref, gitPath, err)\n\t}\n\tlogger.Infof(\"GoGitActionCache fetch %s with ref %s at %s resolved to %s\", url, ref, gitPath, hash.String())\n\treturn hash.String(), nil\n}\n\ntype GitFileInfo struct {\n\tname    string\n\tsize    int64\n\tmodTime time.Time\n\tisDir   bool\n\tmode    fs.FileMode\n}\n\n// IsDir implements fs.FileInfo.\nfunc (g *GitFileInfo) IsDir() bool {\n\treturn g.isDir\n}\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/runner/action_cache.go#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nuses: org/repo/.github/actions/deploy@4b2f6c1a...  # unreachable sha\n\n# after\nuses: org/repo/.github/actions/deploy@v2","handlingStrategy":"fallback","validationCode":"git ls-remote https://github.com/{owner}/{repo} | grep -E \"(refs/(heads|tags)/)?<ref>\" || echo 'ref missing'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["git","ref","cache","act"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}