plandex-ai/plandex · error
error getting untracked files in git repo: %s
Error message
error getting untracked files in git repo: %s
What it means
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.
Source
Thrown at app/cli/fs/paths.go:138
parentDir := relFile
for parentDir != "." && parentDir != "/" && parentDir != "" {
parentDir = filepath.Dir(parentDir)
activeDirs[parentDir] = true
}
}
errCh <- nil
}()
// get all untracked non-ignored files in the repo
numRoutines++
go func() {
cmd := exec.Command("git", "ls-files", "--others", "--exclude-standard")
cmd.Dir = baseDir
out, err := cmd.Output()
if err != nil {
errCh <- fmt.Errorf("error getting untracked files in git repo: %s", err)
return
}
files := strings.Split(string(out), "\n")
mu.Lock()
defer mu.Unlock()
for _, file := range files {
absFile := filepath.Join(baseDir, file)
relFile, err := filepath.Rel(currentDir, absFile)
if err != nil {
errCh <- fmt.Errorf("error getting relative path: %s", err)
return
}
if ignored != nil && ignored.MatchesPath(relFile) {
continueView on GitHub (pinned to e2d772072e)
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.
Defensive patterns
Strategy: validation
Validate before calling
if out, err := exec.Command("git", "-C", baseDir, "ls-files", "--others", "--exclude-standard").Output(); err != nil {
return fmt.Errorf("untracked-file listing failed in %s: %s", baseDir, err)
} Try / catch
if err := <-errCh; err != nil {
if strings.Contains(err.Error(), "error getting untracked files in git repo") {
// inspect the wrapped git error and repair repo or environment
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- error getting git root: %s
- error getting git status: %s
- error getting files in git repo: %s
- error setting git config %s to %s for dir: %s, err: %v, outp
- failed to commit changes: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/340eb44c5079cbce.
Report an issue: GitHub.