{"record":{"id":"c14d95fc6a98c117","repo":"plandex-ai/plandex","slug":"failed-to-commit-v","errorCode":null,"errorMessage":"failed to commit: %v","messagePattern":"failed to commit: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/model/plan/tell_stream_store.go","lineNumber":203,"sourceCode":"\t\t// store subtasks\n\t\terr = db.StorePlanSubtasks(currentOrgId, planId, state.subtasks)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error storing plan subtasks: %v\\n\", err)\n\t\t\tstate.onError(onErrorParams{\n\t\t\t\tstreamErr:      fmt.Errorf(\"failed to store plan subtasks: %v\", err),\n\t\t\t\tstoreDesc:      false,\n\t\t\t\tconvoMessageId: assistantMsg.Id,\n\t\t\t\tcommitMsg:      convoCommitMsg,\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Println(\"Comitting after store on finished\")\n\n\t\terr = repo.GitAddAndCommit(branch, convoCommitMsg)\n\t\tif err != nil {\n\t\t\tstate.onError(onErrorParams{\n\t\t\t\tstreamErr:      fmt.Errorf(\"failed to commit: %v\", err),\n\t\t\t\tstoreDesc:      false,\n\t\t\t\tconvoMessageId: assistantMsg.Id,\n\t\t\t\tcommitMsg:      convoCommitMsg,\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\t\tlog.Println(\"Assistant reply, description, and subtasks committed\")\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"Error storing on finished: %v\\n\", err)\n\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error storing on finished: %v\", err))\n\n\t\tactive.StreamDoneCh <- &shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusInternalServerError,","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/plan/tell_stream_store.go#L185-L221","documentation":"Thrown in storeOnFinished (tell_stream_store.go:203) when repo.GitAddAndCommit fails to stage and commit the changes the model wrote to the working tree on the plan's branch. At this point the assistant message, description, and subtasks have already been persisted, so only the git commit of file changes failed. The wrapped git error is passed to onError and returned, causing the stream to end with a 500 'Error storing on finished'.","triggerScenarios":"repo.GitAddAndCommit(branch, convoCommitMsg) returns an error — typically because the repo working tree has unresolvable conflicts, git is locked (index.lock), no user.name/user.email is configured, the branch is in a detached/conflicted state, or the repo path is missing or not a git repository.","commonSituations":"Another process (IDE, user shell) holds index.lock; repo left mid-merge/rebase from a previous failed run; bare or non-git project dir passed to plandex; git identity not configured in the server's environment/container; filesystem permission problems on .git.","solutions":["Read the wrapped '%v' cause in logs; if it mentions index.lock, remove stale .git/index.lock and retry.","Confirm the plan branch exists and is not mid-merge/rebase; resolve or abort the conflicted state (git merge --abort / git rebase --abort) and retry.","Ensure git user.name and user.email are set in the server environment.","Verify the project path is a valid git repo with correct permissions for the server process."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Stat(filepath.Join(repoPath, \".git\")); err != nil {\n    return fmt.Errorf(\"not a git repository: %w\", err)\n}\nif _, err := os.Stat(filepath.Join(repoPath, \".git\", \"index.lock\")); err == nil {\n    return fmt.Errorf(\"git index locked; another git operation may be in progress\")\n}\nif out, err := exec.Command(\"git\", \"-C\", repoPath, \"config\", \"user.email\"); err != nil || strings.TrimSpace(out.String()) == \"\" {\n    return fmt.Errorf(\"git user.email not configured\")\n}","typeGuard":null,"tryCatchPattern":"if err := repo.GitAddAndCommit(branch, msg); err != nil {\n    if strings.Contains(err.Error(), \"index.lock\") {\n        os.Remove(filepath.Join(repoPath, \".git\", \"index.lock\"))\n        return repo.GitAddAndCommit(branch, msg) // single retry\n    }\n    return fmt.Errorf(\"failed to commit: %w\", err)\n}","preventionTips":["Configure git user.name/user.email in the server container image.","Ensure only one process performs git operations on a plan branch at a time.","Detect and clean up repos left mid-merge/rebase before starting a tell stream.","Verify the project directory is an initialized git repo with writable .git."],"tags":["git","commit","streaming","version-control"],"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"}