plandex-ai/plandex · error
Error getting plan diffs:
Error message
Error getting plan diffs:
What it means
GetPlanDiffsHandler wraps db.GetPlanDiffs inside db.ExecRepoOperation, which acquires a repo lock and opens the plan's git repo. Any error returned by the lock/repo operation or by GetPlanDiffs itself (SQL failures, git repo errors) surfaces as HTTP 500 'Error getting plan diffs: <err>'.
Source
Thrown at app/server/handlers/plans_changes.go:570
UserId: auth.User.Id,
PlanId: planId,
Branch: branch,
Scope: db.LockScopeRead,
Ctx: ctx,
CancelFn: cancel,
}, func(repo *db.GitRepo) error {
var err error
diffs, err = db.GetPlanDiffs(auth.OrgId, planId, plain)
if err != nil {
return err
}
return nil
})
if err != nil {
log.Printf("Error getting plan diffs: %v\n", err)
http.Error(w, "Error getting plan diffs: "+err.Error(), http.StatusInternalServerError)
return
}
log.Printf("diffs: %s", diffs)
w.Write([]byte(diffs))
log.Println("Successfully retrieved plan diffs")
}
View on GitHub (pinned to e2d772072e)
Solutions
- Read the wrapped err.Error() in the server log to distinguish git-repo vs SQL failure
- Retry the request — lock contention and transient DB errors are often temporary
- Check the plan's repo directory exists and is a valid git repo on the server; restore from backup if corrupted
- Verify database connectivity and that the plans/context tables are intact
- Keep the client connected (raise timeout) so ctx isn't canceled while waiting for the lock
Defensive patterns
Strategy: retry
Validate before calling
// pre-check plan repo exists before calling
if _, err := os.Stat(repoPath); os.IsNotExist(err) { return fmt.Errorf("plan repo missing") } Try / catch
err := db.ExecRepoOperation(params, fn)
if err != nil {
if errors.Is(err, context.Canceled) { http.Error(w, "request canceled", http.StatusRequestTimeout); return }
http.Error(w, "Error getting plan diffs: "+err.Error(), http.StatusInternalServerError)
} Prevention
- Retry on lock-contention errors with backoff
- Monitor plan git repo directories for corruption/loss
- Keep HTTP client timeouts long enough to survive lock waits
- Verify DB connectivity before diagnosing deeper
When it happens
Trigger: ExecRepoOperation fails (repo lock contention/cancellation, missing or corrupt plan git repo on disk) or the GetPlanDiffs SQL query errors for orgId/planId.
Common situations: Plan's internal git repository missing or corrupted on the server volume; concurrent write lock held on the plan causing wait/cancel (client disconnect cancels ctx); database connectivity failure mid-request; context canceled because the HTTP client timed out.
Related errors
- error invalidating conflicted results: %v
- error getting current plan state params: %v
- error getting contexts: %v
- error rejecting plan file: %v
- error validating project
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/82cfbb7525b27140.
Report an issue: GitHub.