nektos/act · error

GoGitActionCache failed to open git tree %s with sha %s subp

Error message

GoGitActionCache failed to open git tree %s with sha %s subpath '%s' at %s: %w

What it means

After loading the commit, GetTarArchive reads its root tree with commit.Tree(). This wraps a go-git object-read failure for the tree: the commit object exists but its tree object is missing from the (shallow, depth=1) object database, or the object store is corrupt — distinct from loading the commit itself.

Source

Thrown at pkg/runner/action_cache.go:147

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:
		}
	}()
	go func() {
		defer wpipe.Close()
		defer close(ch)

View on GitHub (pinned to 4f41128141)

Solutions

  1. Wipe the cache repo named in the error: rm -rf <gitPath>, then re-run.
  2. Check disk space on the cache volume (df -h) — ENOSPC during fetch produces truncated object stores.
  3. Upgrade act so the go-git version writing and reading the cache matches.
  4. If persistent, move the cache: act --action-cache-path /new/dir.

Example fix

# before
act  # failed to open git tree ... object not found

# after
rm -rf ~/.cache/act && act
Defensive patterns

Strategy: fallback

Validate before calling

git --git-dir="$HOME/.cache/act/<cache-name>.git" fsck --no-dangling 2>&1 | head -5  # spot corrupt objects before running

Prevention

When it happens

Trigger: Shallow fetch stored the commit but not its tree (partial fetch interrupted after commit arrival), corrupt loose/pack objects in the bare cache, or object pruning removed the tree.

Common situations: Interrupted (Ctrl-C / OOM-killed) act run leaving half-populated objects; disk-full during fetch; cache written on one act version and read by an incompatible go-git version.

Related errors


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