{"record":{"id":"340eb44c5079cbce","repo":"plandex-ai/plandex","slug":"error-getting-untracked-files-in-git-repo-s","errorCode":null,"errorMessage":"error getting untracked files in git repo: %s","messagePattern":"error getting untracked files in git repo: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/fs/paths.go","lineNumber":138,"sourceCode":"\t\t\t\tparentDir := relFile\n\t\t\t\tfor parentDir != \".\" && parentDir != \"/\" && parentDir != \"\" {\n\t\t\t\t\tparentDir = filepath.Dir(parentDir)\n\t\t\t\t\tactiveDirs[parentDir] = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terrCh <- nil\n\t\t}()\n\n\t\t// get all untracked non-ignored files in the repo\n\t\tnumRoutines++\n\t\tgo func() {\n\t\t\tcmd := exec.Command(\"git\", \"ls-files\", \"--others\", \"--exclude-standard\")\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 untracked 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":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/fs/paths.go#L120-L156","documentation":"The untracked-files goroutine runs `git ls-files --others --exclude-standard` in baseDir to list untracked but non-ignored files. This error is thrown when that git command exits non-zero, aborting GetPaths. Like the other git wrappers, the underlying exec error is embedded in the message via %s.","triggerScenarios":"Calling GetPaths where `git ls-files --others --exclude-standard` fails: corrupt index (this command reads the index to exclude tracked files), dubious-ownership safe.directory rejection, git binary missing, permissions problems on .git, or a huge/deep repo hitting resource limits.","commonSituations":"Running as a different user than the repo owner (containers, sudo); interrupted git operations leaving .git in a bad state; minimal CI images without git; read-only mounts preventing git from reading required files.","solutions":["Run `git ls-files --others --exclude-standard` manually in the project directory and fix the reported git error.","Add the repo to safe.directory when ownership mismatch is reported: `git config --global --add safe.directory <path>`.","Ensure git is installed and functional (`git --version`) in the environment.","Repair or re-clone the repository if the index or .git metadata is corrupt."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if out, err := exec.Command(\"git\", \"-C\", baseDir, \"ls-files\", \"--others\", \"--exclude-standard\").Output(); err != nil {\n\treturn fmt.Errorf(\"untracked-file listing failed in %s: %s\", baseDir, err)\n}","typeGuard":null,"tryCatchPattern":"if err := <-errCh; err != nil {\n\tif strings.Contains(err.Error(), \"error getting untracked files in git repo\") {\n\t\t// inspect the wrapped git error and repair repo or environment\n\t}\n}","preventionTips":["Verify the exact command `git ls-files --others --exclude-standard` succeeds before running the tool","Keep the git index healthy; run `git status` to detect corruption early","Use images with git installed for CI/container runs","Align file ownership between the running user and the repository"],"tags":["git","go","exec"],"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-12T22:17:10.623Z"}