plandex-ai/plandex · error
error getting git history for dir: %s, err: %v
Error message
error getting git history for dir: %s, err: %v
What it means
getLatestCommit: `git log --pretty=...` in the plan repo directory failed, so the latest commit sha/message cannot be read. Usually means the directory is not a git repo, has no commits, or git itself errored.
Source
Thrown at app/server/db/git.go:476
}
func gitRewindToSha(repoDir, sha string) error {
res, err := exec.Command("git", "-C", repoDir, "reset", "--hard", sha).CombinedOutput()
if err != nil {
return fmt.Errorf("error executing git reset for dir: %s, sha: %s, err: %v, output: %s", repoDir, sha, err, string(res))
}
return nil
}
func getLatestCommit(dir string) (sha, body string, err error) {
var out bytes.Buffer
cmd := exec.Command("git", "log", "--pretty=%h@@|@@%at@@|@@%B@>>>@")
cmd.Dir = dir
cmd.Stdout = &out
err = cmd.Run()
if err != nil {
return "", "", fmt.Errorf("error getting git history for dir: %s, err: %v", dir, err)
}
// Process the log output to get it in the desired format.
history := processGitHistoryOutput(strings.TrimSpace(out.String()))
first := history[0]
sha = first[0]
body = first[1]
return sha, body, nil
}
func getGitCommitHistory(dir string) (body string, shas []string, err error) {
var out bytes.Buffer
cmd := exec.Command("git", "log", "--pretty=%h@@|@@%at@@|@@%B@>>>@")
cmd.Dir = dir
cmd.Stdout = &outView on GitHub (pinned to e2d772072e)
Solutions
- Confirm the directory contains an initialized git repo with commits
- Run git log manually in that dir to reproduce
- Check repo ownership/safe.directory settings
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at app/server/db/git.go:476 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/e16ce8481b93f76c.
Report an issue: GitHub.