nektos/act · error
GoGitActionCache failed to get commit %s with sha %s subpath
Error message
GoGitActionCache failed to get commit %s with sha %s subpath '%s' at %s: %w
What it means
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.
Source
Thrown at pkg/runner/action_cache.go:143
// 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 {
case <-ctx.Done():
wpipe.CloseWithError(ctx.Err())
case <-ch:
}View on GitHub (pinned to 4f41128141)
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.
Example fix
# before uses: org/repo/.github/actions/build@main # ref moved between runs # after uses: org/repo/.github/actions/build@v3.1.0
Defensive patterns
Strategy: fallback
Validate before calling
git --git-dir="$HOME/.cache/act/<cache-name>.git" cat-file -t <sha> 2>/dev/null || echo 'commit not in cache — clear it'
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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>'.
Related errors
- GoGitActionCache failed to open bare git %s with ref %s at %
- GoGitActionCache failed to resolve sha %s with ref %s at %s:
- GoGitActionCache failed to open bare git %s with sha %s subp
- GoGitActionCache failed to open git tree %s with sha %s subp
- GoGitActionCache failed to list files %s with sha %s subpath
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/f6db8febddb48d22.
Report an issue: GitHub.