{"record":{"id":"04713b1bbbed19d3","repo":"plandex-ai/plandex","slug":"error-committing-rejected-changes-v","errorCode":null,"errorMessage":"error committing rejected changes: %v","messagePattern":"error committing rejected changes: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/plans_changes.go","lineNumber":287,"sourceCode":"\n\terr := db.ExecRepoOperation(db.ExecRepoOperationParams{\n\t\tOrgId:          auth.OrgId,\n\t\tUserId:         auth.User.Id,\n\t\tPlanId:         planId,\n\t\tBranch:         branch,\n\t\tScope:          db.LockScopeWrite,\n\t\tCtx:            ctx,\n\t\tCancelFn:       cancel,\n\t\tClearRepoOnErr: true,\n\t}, func(repo *db.GitRepo) error {\n\t\terr := db.RejectAllResults(auth.OrgId, planId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = repo.GitAddAndCommit(branch, \"🚫 Rejected all pending changes\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error committing rejected changes: %v\", err)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"Error rejecting all changes: %v\\n\", err)\n\t\thttp.Error(w, \"Error rejecting all changes: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(\"Successfully rejected all changes for plan\", planId)\n}\n\nfunc RejectFileHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for RejectFileHandler\")\n\n\tauth := Authenticate(w, r, true)","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/plans_changes.go#L269-L305","documentation":"Returned by RejectAllChangesHandler when repo.GitAddAndCommit(branch, ...) fails after db.RejectAllResults succeeded. The DB rejection is already applied but the git commit recording it could not be made, leaving the repo and DB out of sync; the operation is wrapped and surfaced as HTTP 500 'Error rejecting all changes'.","triggerScenarios":"POSTing reject-all for a plan when the git working tree has nothing to commit, an index lock exists (.git/index.lock), git identity is unconfigured, or the branch is in a conflicted state.","commonSituations":"Concurrent operations leaving a stale index.lock; repo clone cleared or corrupted (ClearRepoOnErr paths); missing git user.email/user.name in the server environment; branch checked out elsewhere.","solutions":["Check the wrapped git error in the logs (lock file, identity, dirty tree)","Remove any stale .git/index.lock in the plan's repo working dir","Configure git user.name/user.email in the server environment","Re-run the reject operation; ClearRepoOnErr will re-clone a corrupt repo"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(repoWorkdir + \"/.git\"); err != nil {\n    return fmt.Errorf(\"plan repo is not initialized: %w\", err)\n}\nif _, err := os.Stat(repoWorkdir + \"/.git/index.lock\"); err == nil {\n    return errors.New(\"git index is locked; another operation may be in progress\")\n}","typeGuard":null,"tryCatchPattern":"err := repo.GitAddAndCommit(branch, \"🚫 Rejected all pending changes\")\nif err != nil {\n    if strings.Contains(err.Error(), \"nothing to commit\") {\n        return nil\n    }\n    return fmt.Errorf(\"error committing rejected changes: %w\", err)\n}","preventionTips":["Configure git user.name/user.email in the server environment","Clean stale .git/index.lock files after crashed operations","Treat 'nothing to commit' as success for idempotent reject flows"],"tags":["go","git","commit"],"backgroundTag":"git-commit-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}