{"record":{"id":"fb7551a03fee6a96","repo":"nektos/act","slug":"gogitactioncache-failed-to-open-bare-git-s-with-r","errorCode":null,"errorMessage":"GoGitActionCache failed to open bare git %s with ref %s at %s: %w","messagePattern":"GoGitActionCache failed to open bare git (.+?) with ref (.+?) at (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runner/action_cache.go","lineNumber":47,"sourceCode":"\ntype GoGitActionCache struct {\n\tPath string\n}\n\nfunc (c GoGitActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error) {\n\tlogger := common.Logger(ctx)\n\n\tgitPath := path.Join(c.Path, safeFilename(cacheDir)+\".git\")\n\n\tlogger.Infof(\"GoGitActionCache fetch %s with ref %s at %s\", url, ref, gitPath)\n\n\tgogitrepo, err := git.PlainInit(gitPath, true)\n\tif errors.Is(err, git.ErrRepositoryAlreadyExists) {\n\t\tlogger.Debugf(\"GoGitActionCache cache hit %s with ref %s at %s\", url, ref, gitPath)\n\t\tgogitrepo, err = git.PlainOpen(gitPath)\n\t}\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"GoGitActionCache failed to open bare git %s with ref %s at %s: %w\", url, ref, gitPath, err)\n\t}\n\ttmpBranch := make([]byte, 12)\n\tif _, err := rand.Read(tmpBranch); err != nil {\n\t\treturn \"\", fmt.Errorf(\"GoGitActionCache failed to generate random tmp branch %s with ref %s at %s: %w\", url, ref, gitPath, err)\n\t}\n\tbranchName := hex.EncodeToString(tmpBranch)\n\n\tvar auth transport.AuthMethod\n\tif token != \"\" {\n\t\tauth = &http.BasicAuth{\n\t\t\tUsername: \"token\",\n\t\t\tPassword: token,\n\t\t}\n\t}\n\tremote, err := gogitrepo.CreateRemoteAnonymous(&config.RemoteConfig{\n\t\tName: \"anonymous\",\n\t\tURLs: []string{\n\t\t\turl,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/runner/action_cache.go#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Delete the specific corrupt cache repo printed in the error path (the '<...>.git' directory), or the whole cache: rm -rf ~/.cache/act.","Fix permissions: chown -R $(id -u):$(id -g) ~/.cache/act && chmod -R u+rwX ~/.cache/act.","Point act at a writable cache: act --action-cache-path /path/to/writable/dir.","Check disk space (df -h) and filesystem permissions on the parent of the cache path."],"exampleFix":"# before\nact  # error: GoGitActionCache failed to open bare git ... : repository does not exist / permission denied\n\n# after\nrm -rf ~/.cache/act\nact --action-cache-path \"$HOME/.cache/act\"","handlingStrategy":"validation","validationCode":"CACHE=\"${ACT_CACHE_PATH:-$HOME/.cache/act}\"\n[ -w \"$CACHE\" ] || { echo \"cache dir not writable: $CACHE\"; exit 1; }\n# detect corrupt bare repos: a valid one has HEAD and objects/\nfor d in \"$CACHE\"/*.git; do [ -f \"$d/HEAD\" ] || { echo \"corrupt: $d\"; exit 1; }; done","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a dedicated writable --action-cache-path per environment/user.","Clean ~/.cache/act after interrupted runs.","Ensure consistent ownership of the cache directory across act invocations."],"tags":["git","cache","filesystem","act"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}