plandex-ai/plandex · error
error committing plan build: %v
Error message
error committing plan build: %v
What it means
This error is returned from onFinishBuild in plan/build_finish.go when GitAddAndCommit fails while committing the plan's pending changes inside a repo write lock. Plandex stores plan builds as git commits on an internal branch; if the commit command returns anything other than "nothing to commit" it is wrapped as "error committing plan build: %v" and propagated to the stream as a 500 ApiError. It means the internal git repo operation failed, not that the plan itself is wrong.
Source
Thrown at app/server/model/plan/build_finish.go:135
}(desc)
}
for range unbuiltDescs {
err = <-descErrCh
if err != nil {
log.Printf("Error storing description: %v\n", err)
return err
}
}
err = repo.GitAddAndCommit(branch, currentPlan.PendingChangesSummaryForBuild())
if err != nil {
if strings.Contains(err.Error(), "nothing to commit") {
log.Println("Nothing to commit")
return nil
}
return fmt.Errorf("error committing plan build: %v", err)
}
log.Println("Plan build committed")
return nil
})
if err != nil {
log.Printf("Error finishing build: %v\n", err)
if err.Error() != context.Canceled.Error() {
go notify.NotifyErr(notify.SeverityError, fmt.Errorf("error finishing build: %v", err))
ap.StreamDoneCh <- &shared.ApiError{
Type: shared.ApiErrorTypeOther,
Status: http.StatusInternalServerError,
Msg: "Error finishing build: " + err.Error(),
}View on GitHub (pinned to e2d772072e)
Solutions
- Check the wrapped inner error in the log ("Error finishing build: error committing plan build: ...") to identify the root cause (disk full, permissions, index.lock, etc.)
- If a stale git index.lock exists in the plan's internal repo, remove it and retry the build
- Verify git is installed and executable by the server process, and that the plans data directory is writable
- Check available disk space and filesystem health on the volume holding plan repos
- If the internal repo is corrupted, restore from backup or re-initialize the plan's git repo
Example fix
// before
err = repo.GitAddAndCommit(branch, currentPlan.PendingChangesSummaryForBuild())
if err != nil {
return fmt.Errorf("error committing plan build: %v", err)
}
// after
err = repo.GitAddAndCommit(branch, currentPlan.PendingChangesSummaryForBuild())
if err != nil {
if strings.Contains(err.Error(), "index.lock") {
os.Remove(filepath.Join(repo.Dir, ".git", "index.lock")) // clear stale lock, then retry
err = repo.GitAddAndCommit(branch, currentPlan.PendingChangesSummaryForBuild())
}
if err != nil {
return fmt.Errorf("error committing plan build: %v", err)
}
} Defensive patterns
Strategy: retry
Validate before calling
// before running a plan build, check repo health
if _, err := os.Stat(filepath.Join(repoDir, ".git", "index.lock")); err == nil {
return fmt.Errorf("stale git index.lock present in %s; remove it before building", repoDir)
}
out, err := exec.LookPath("git")
if err != nil {
return fmt.Errorf("git binary not found on PATH")
}
if err := hasFreeDiskSpace(dataDir, 100<<20); err != nil { // need >=100MB
return err
} Try / catch
if err := db.ExecRepoOperation(...); err != nil {
if strings.Contains(err.Error(), "index.lock") {
// clear stale lock and retry once
} else if strings.Contains(err.Error(), "no space left") {
// alert ops: disk full
} else {
// surface wrapped "error committing plan build" with inner cause
}
} Prevention
- Monitor disk space and permissions on the volume storing plan git repos
- Ensure the server container image includes the git binary
- Clean up stale index.lock files after server crashes (startup health check)
- Avoid running multiple server instances against the same plans data directory
When it happens
Trigger: Calling onFinishBuild after all file builds complete and repo.GitAddAndCommit returns an error other than "nothing to commit": git binary missing or not on PATH, corrupted internal .git directory, git index.lock left over from a killed process, disk full, permission problems on the plans repo directory, or branch ref write failures.
Common situations: Self-hosted deployments with a full disk or a plans data volume owned by the wrong user; concurrent processes contending for the same repo leaving a stale index.lock; upgrading/moving the data dir and breaking git object permissions; container images missing the git binary.
Related errors
- error getting git root: %s
- error getting files in git repo: %s
- error committing files to git repository for dir: %s, err: %
- error committing files to git repository for dir: %s, err: %
- error storing context: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/8186c9cb01f95ad8.
Report an issue: GitHub.