{"record":{"id":"6f1e2ff437774f6e","repo":"plandex-ai/plandex","slug":"error-committing-changes-v","errorCode":null,"errorMessage":"error committing changes: %v","messagePattern":"error committing changes: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/context_helper.go","lineNumber":274,"sourceCode":"\t\tfor _, context := range dbContexts {\n\t\t\tif context.ContextType == shared.ContextMapType {\n\t\t\t\tmapContextsCount++\n\t\t\t\tlog.Printf(\"[ContextHelper] Loaded map context: %s, path: %s, tokens: %d\", context.Name, context.FilePath, context.NumTokens)\n\t\t\t}\n\t\t}\n\t\tif mapContextsCount > 0 {\n\t\t\tlog.Printf(\"[ContextHelper] Successfully loaded %d map contexts out of %d total contexts\", mapContextsCount, len(dbContexts))\n\t\t}\n\n\t\tif loadRes.MaxTokensExceeded {\n\t\t\treturn nil\n\t\t}\n\n\t\tlog.Printf(\"[ContextHelper] Committing changes to branch %s\", branchName)\n\t\terr = repo.GitAddAndCommit(branchName, res.Msg)\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error committing changes: %v\", err)\n\t\t}\n\n\t\tlog.Printf(\"[ContextHelper] Committing changes to branch %s completed successfully\", branchName)\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"Error loading contexts: %v\\n\", err)\n\t\thttp.Error(w, \"Error loading contexts: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn nil, nil\n\t}\n\n\tif loadRes.MaxTokensExceeded {\n\t\tlog.Printf(\"The total number of tokens (%d) exceeds the maximum allowed (%d)\", loadRes.TotalTokens, loadRes.MaxTokens)\n\t\tbytes, err := json.Marshal(loadRes)\n\n\t\tif err != nil {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/context_helper.go#L256-L292","documentation":"After contexts are loaded, repo.GitAddAndCommit fails committing the context-change message to the plan branch. Git-level failure: lock file, merge state, or repo corruption — the DB context rows may exist without the matching git commit.","triggerScenarios":"Thrown at app/server/handlers/context_helper.go:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped GitAddAndCommit error for git's output","Check for a stale index.lock in the plan repo","Verify repo integrity (git status/fsck) and retry the commit"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}