{"record":{"id":"fd78147d82f54201","repo":"plandex-ai/plandex","slug":"error-getting-files-in-git-repo-s","errorCode":null,"errorMessage":"error getting files in git repo: %s","messagePattern":"error getting files in git repo: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/fs/paths.go","lineNumber":97,"sourceCode":"\t\t\t\t\tdeletedFiles[relPath] = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terrCh <- nil\n\t\t}()\n\n\t\t// combine `git ls-files` and `git ls-files --others --exclude-standard`\n\t\t// to get all files in the repo\n\n\t\tnumRoutines++\n\t\tgo func() {\n\t\t\t// get all tracked files in the repo\n\t\t\tcmd := exec.Command(\"git\", \"ls-files\")\n\t\t\tcmd.Dir = baseDir\n\t\t\tout, err := cmd.Output()\n\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error getting files in git repo: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfiles := strings.Split(string(out), \"\\n\")\n\n\t\t\tmu.Lock()\n\t\t\tdefer mu.Unlock()\n\t\t\tfor _, file := range files {\n\t\t\t\tabsFile := filepath.Join(baseDir, file)\n\t\t\t\trelFile, err := filepath.Rel(currentDir, absFile)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\terrCh <- fmt.Errorf(\"error getting relative path: %s\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif ignored != nil && ignored.MatchesPath(relFile) {\n\t\t\t\t\tcontinue","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/fs/paths.go#L79-L115","documentation":"The tracked-files goroutine runs `git ls-files` with cmd.Dir set to baseDir to enumerate all files git tracks. This error is thrown when that command exits non-zero or cannot be executed, so GetPaths aborts and returns the error instead of a ProjectPaths struct.","triggerScenarios":"Calling GetPaths on a repo where `git ls-files` fails: corrupt or missing .git/index, dubious-ownership rejection, git not found on PATH, insufficient read permissions on the repo, or repo deleted between the IsGitRepo check and this call.","commonSituations":"Running in CI containers without git installed; repo mounted read-only or owned by another user; corrupt index after a crash (stale .git/index.lock); git safe.directory errors when the repo is owned by a different UID.","solutions":["Run `git ls-files` manually in the project directory to see the underlying git error, then fix it.","Install/repair git and ensure it is on PATH in the execution environment.","Add `git config --global --add safe.directory <repo-path>` for ownership mismatches.","Remove a stale .git/index.lock (with no git process running) or restore a corrupt index (`git read-tree HEAD` / re-clone)."],"exampleFix":"// before (Dockerfile)\nFROM alpine\nCMD [\"plandex\", \"load\"]\n// after\nFROM alpine\nRUN apk add --no-cache git\nCMD [\"plandex\", \"load\"]","handlingStrategy":"validation","validationCode":"if out, err := exec.Command(\"git\", \"-C\", baseDir, \"ls-files\").Output(); err != nil {\n\treturn fmt.Errorf(\"git ls-files failed in %s: %s\", baseDir, err)\n}","typeGuard":null,"tryCatchPattern":"if err := <-errCh; err != nil {\n\tif strings.Contains(err.Error(), \"error getting files in git repo\") {\n\t\t// fall back to filepath.Walk-based scanning or surface the wrapped git error\n\t}\n}","preventionTips":["Ensure git is installed and on PATH in every environment that runs the tool","Check repo health with `git fsck` if errors persist","Configure safe.directory for ownership mismatches","Do not delete the repository or its .git directory mid-operation"],"tags":["git","go","exec","filesystem"],"backgroundTag":"git-command-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}