{"record":{"id":"f6db8febddb48d22","repo":"nektos/act","slug":"gogitactioncache-failed-to-get-commit-s-with-sha","errorCode":null,"errorMessage":"GoGitActionCache failed to get commit %s with sha %s subpath '%s' at %s: %w","messagePattern":"GoGitActionCache failed to get commit (.+?) with sha (.+?) subpath '(.+?)' at (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runner/action_cache.go","lineNumber":143,"sourceCode":"// Sys implements fs.FileInfo.\nfunc (g *GitFileInfo) Sys() any {\n\treturn nil\n}\n\nfunc (c GoGitActionCache) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error) {\n\tlogger := common.Logger(ctx)\n\n\tgitPath := path.Join(c.Path, safeFilename(cacheDir)+\".git\")\n\n\tlogger.Infof(\"GoGitActionCache get content %s with sha %s subpath '%s' at %s\", cacheDir, sha, includePrefix, gitPath)\n\n\tgogitrepo, err := git.PlainOpen(gitPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GoGitActionCache failed to open bare git %s with sha %s subpath '%s' at %s: %w\", cacheDir, sha, includePrefix, gitPath, err)\n\t}\n\tcommit, err := gogitrepo.CommitObject(plumbing.NewHash(sha))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GoGitActionCache failed to get commit %s with sha %s subpath '%s' at %s: %w\", cacheDir, sha, includePrefix, gitPath, err)\n\t}\n\tt, err := commit.Tree()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GoGitActionCache failed to open git tree %s with sha %s subpath '%s' at %s: %w\", cacheDir, sha, includePrefix, gitPath, err)\n\t}\n\tfiles, err := commit.Files()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GoGitActionCache failed to list files %s with sha %s subpath '%s' at %s: %w\", cacheDir, sha, includePrefix, gitPath, err)\n\t}\n\trpipe, wpipe := io.Pipe()\n\t// Interrupt io.Copy using ctx\n\tch := make(chan int, 1)\n\tgo func() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\twpipe.CloseWithError(ctx.Err())\n\t\tcase <-ch:\n\t\t}","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/runner/action_cache.go#L125-L161","documentation":"GetTarArchive looks up the fetched commit with gogitrepo.CommitObject(plumbing.NewHash(sha)). This error wraps failure to load that commit object: the sha is not a 40-hex string (NewHash truncates/garbles it), the object is missing from the shallow clone (depth=1 fetched a different commit), or the object database is corrupt.","triggerScenarios":"The sha passed in does not correspond to what Fetch actually stored — e.g. the ref moved between fetch and materialize, a shallow (Depth:1) fetch did not include the requested commit, or cache corruption dropped the object.","commonSituations":"Branch force-pushed mid-run; action ref updated between two act runs sharing a cache; corrupt cache after an interrupted run; invalid sha characters in 'uses: repo@<ref>'.","solutions":["Clear the affected cache repo: rm -rf <gitPath from the error>, then re-run so Fetch re-fetches a consistent sha.","Pin 'uses:' to an immutable tag or full sha so the fetched commit matches the requested one.","Re-run — if a force-push raced the fetch, a fresh run re-resolves the ref.","Avoid sharing one cache dir across concurrently running act instances."],"exampleFix":"# before\nuses: org/repo/.github/actions/build@main   # ref moved between runs\n\n# after\nuses: org/repo/.github/actions/build@v3.1.0","handlingStrategy":"fallback","validationCode":"git --git-dir=\"$HOME/.cache/act/<cache-name>.git\" cat-file -t <sha> 2>/dev/null || echo 'commit not in cache — clear it'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin reusable actions to immutable tags/shas.","Clear the affected *.git cache after force-pushes upstream.","Re-run the job when refs move mid-run."],"tags":["git","sha","cache","act"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}