{"record":{"id":"172caa524d6f9c8e","repo":"plandex-ai/plandex","slug":"error-getting-git-status-s","errorCode":null,"errorMessage":"error getting git status: %s","messagePattern":"error getting git status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/fs/paths.go","lineNumber":64,"sourceCode":"\n\tif isGitRepo {\n\n\t\t// Use git status to find deleted files\n\t\tnumRoutines++\n\t\tgo func() {\n\t\t\tcmd := exec.Command(\"git\", \"rev-parse\", \"--show-toplevel\")\n\t\t\toutput, err := cmd.Output()\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error getting git root: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\trepoRoot := strings.TrimSpace(string(output))\n\n\t\t\tcmd = exec.Command(\"git\", \"status\", \"--porcelain\")\n\t\t\tcmd.Dir = baseDir\n\t\t\tout, err := cmd.Output()\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error getting git status: %s\", err)\n\t\t\t}\n\n\t\t\tlines := strings.Split(string(out), \"\\n\")\n\n\t\t\tfor _, line := range lines {\n\t\t\t\tline = strings.TrimSpace(line)\n\t\t\t\tif strings.HasPrefix(line, \"D \") {\n\t\t\t\t\tpath := strings.TrimSpace(line[2:])\n\t\t\t\t\tabsPath := filepath.Join(repoRoot, path)\n\t\t\t\t\trelPath, err := filepath.Rel(currentDir, absPath)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrCh <- fmt.Errorf(\"error getting relative path: %s\", err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdeletedFiles[relPath] = true\n\t\t\t\t}\n\t\t\t}\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/fs/paths.go#L46-L82","documentation":"After finding the repo root, the deleted-file detection goroutine runs `git status --porcelain` in baseDir. This error is thrown when that command exits non-zero. Note a bug in the surrounding code: on this path the goroutine sends the error but does NOT return, so it continues to parse an empty/partial output before later sending nil on errCh — potentially causing a panic from double-send or goroutine leak.","triggerScenarios":"Calling GetPaths on a git repo where `git status --porcelain` fails: corrupt index (e.g. .git/index unreadable), dubious-ownership safe.directory rejection, a broken .gitconfig (invalid config values cause git to exit with error), or git not on PATH.","commonSituations":"Running inside Docker as a different user than the repo owner; a malformed .gitconfig or hook config; interrupted operations leaving a locked/corrupt .git/index; sandboxed CI runners with restricted permissions on .git.","solutions":["Run `git status --porcelain` manually in the project directory and fix the reported git error (lock file, ownership, config).","Add safe.directory entries: `git config --global --add safe.directory <repo-path>` when running as another user/container.","Remove stale lock files (e.g. .git/index.lock) if git reports them, after confirming no git process is running.","Validate .gitconfig / global config for invalid keys or values that make every git invocation fail."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"cmd := exec.Command(\"git\", \"-C\", baseDir, \"status\", \"--porcelain\")\nif err := cmd.Run(); err != nil {\n\treturn fmt.Errorf(\"git status unavailable in %s: %w\", baseDir, err)\n}","typeGuard":null,"tryCatchPattern":"if err := <-errCh; err != nil {\n\tif strings.Contains(err.Error(), \"error getting git status\") {\n\t\t// inspect wrapped git error: lock file, ownership, config\n\t}\n}","preventionTips":["Run `git status` in the project before using the tool to confirm repo health","Remove stale .git/index.lock files only when no git process is running","Add safe.directory entries for repos owned by another user/UID","Keep global and repo git config free of invalid keys/values"],"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-14T00:17:10.932Z"}