nektos/act · error

GoGitActionCache failed to open bare git

Error message

GoGitActionCache failed to open bare git %s with ref %s at %s: %w

What it means

GoGitActionCache.Fetch (pkg/runner/action_cache.go) maintains bare git repos under c.Path named safeFilename(cacheDir)+".git". It first tries git.PlainInit(gitPath, true) to create a bare repo; if the repo already exists it opens it with git.PlainOpen. This error wraps failure of BOTH calls: PlainInit failed with something other than ErrRepositoryAlreadyExists (permissions, disk full, invalid path) or PlainOpen failed on an existing but corrupt directory.

Solutions

  1. Delete the specific corrupt cache repo printed in the error path (the '<...>.git' directory), or the whole cache: rm -rf ~/.cache/act.
  2. Fix permissions: chown -R $(id -u):$(id -g) ~/.cache/act && chmod -R u+rwX ~/.cache/act.
  3. Point act at a writable cache: act --action-cache-path /path/to/writable/dir.
  4. Check disk space (df -h) and filesystem permissions on the parent of the cache path.

Example fix

# before
act  # error: GoGitActionCache failed to open bare git ... : repository does not exist / permission denied

# after
rm -rf ~/.cache/act
act --action-cache-path "$HOME/.cache/act"
Defensive patterns

Strategy: validation

Validate before calling

CACHE="${ACT_CACHE_PATH:-$HOME/.cache/act}"
[ -w "$CACHE" ] || { echo "cache dir not writable: $CACHE"; exit 1; }
# detect corrupt bare repos: a valid one has HEAD and objects/
for d in "$CACHE"/*.git; do [ -f "$d/HEAD" ] || { echo "corrupt: $d"; exit 1; }; done

Prevention

When it happens

Trigger: The host cache directory (~/.cache/act by default, or --action-cache-path) has wrong ownership/permissions, is on a read-only filesystem, is full, or contains a corrupt/partially-created *.git directory from a previously interrupted run.

Common situations: Running act as a different user than the one that created ~/.cache/act; a killed act process left a half-initialized bare repo; Docker desktop VM file mapping issues; SELinux/AppArmor denial on the cache path.

Related errors


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

Appendix: source

Thrown at pkg/runner/action_cache.go:47

type GoGitActionCache struct {
	Path string
}

func (c GoGitActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error) {
	logger := common.Logger(ctx)

	gitPath := path.Join(c.Path, safeFilename(cacheDir)+".git")

	logger.Infof("GoGitActionCache fetch %s with ref %s at %s", url, ref, gitPath)

	gogitrepo, err := git.PlainInit(gitPath, true)
	if errors.Is(err, git.ErrRepositoryAlreadyExists) {
		logger.Debugf("GoGitActionCache cache hit %s with ref %s at %s", url, ref, gitPath)
		gogitrepo, err = git.PlainOpen(gitPath)
	}
	if err != nil {
		return "", fmt.Errorf("GoGitActionCache failed to open bare git %s with ref %s at %s: %w", url, ref, gitPath, err)
	}
	tmpBranch := make([]byte, 12)
	if _, err := rand.Read(tmpBranch); err != nil {
		return "", fmt.Errorf("GoGitActionCache failed to generate random tmp branch %s with ref %s at %s: %w", url, ref, gitPath, err)
	}
	branchName := hex.EncodeToString(tmpBranch)

	var auth transport.AuthMethod
	if token != "" {
		auth = &http.BasicAuth{
			Username: "token",
			Password: token,
		}
	}
	remote, err := gogitrepo.CreateRemoteAnonymous(&config.RemoteConfig{
		Name: "anonymous",
		URLs: []string{
			url,

View on GitHub (pinned to 4f41128141)