{"record":{"id":"c5a10ed8972f768b","repo":"plandex-ai/plandex","slug":"error-generating-commit-message","errorCode":null,"errorMessage":"Error generating commit message: ","messagePattern":"Error generating commit message: ","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/plans_changes.go","lineNumber":215,"sourceCode":"\t)\n\n\tclients := res.clients\n\tauthVars := res.authVars\n\n\tcommitMsg, err := modelPlan.GenCommitMsgForPendingResults(modelPlan.GenCommitMsgForPendingResultsParams{\n\t\tAuth:      auth,\n\t\tPlan:      plan,\n\t\tClients:   clients,\n\t\tSettings:  settings,\n\t\tCurrent:   currentPlan,\n\t\tAuthVars:  authVars,\n\t\tSessionId: requestBody.SessionId,\n\t\tCtx:       r.Context(),\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"Error generating commit message: %v\\n\", err)\n\t\thttp.Error(w, \"Error generating commit message: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\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\treturn db.ApplyPlan(repo, ctx, db.ApplyPlanParams{\n\t\t\tOrgId:                  auth.OrgId,\n\t\t\tUserId:                 auth.User.Id,\n\t\t\tBranchName:             branch,\n\t\t\tPlan:                   plan,","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/plans_changes.go#L197-L233","documentation":"After loading state, ApplyPlanHandler calls GenCommitMsgForPendingResults, which asks the LLM to write a commit message for the pending changes. Any failure there (API error, auth, streaming) yields 500 'Error generating commit message: <detail>'. The plan was not applied because this runs before db.ApplyPlan.","triggerScenarios":"LLM provider returns an error or rate limit; invalid/missing API key or org id supplied in ApplyPlanRequest; model name in plan settings unavailable; request context cancelled during generation.","commonSituations":"Expired or wrong OpenAI/Anthropic API key; OpenAI org mismatch; model deprecated or not entitled; provider outage or 429 rate limiting; network egress blocked from the server.","solutions":["Check the appended error detail for the provider's status/message (401 => key, 429 => rate limit, 404 => model)","Verify the API keys and openAIOrgId sent in ApplyPlanRequest are valid and funded","Update the plan settings to a currently available model","Retry after a provider outage/rate limit; consider setting a commit message manually if the feature allows"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// before calling apply, confirm credentials are present\nif (!apiKeys?.openai && !process.env.OPENAI_API_KEY) throw new Error('missing LLM API key');","typeGuard":"null","tryCatchPattern":"const res = await fetch(applyUrl, opts);\nif (res.status === 500) {\n  const msg = await res.text();\n  if (msg.includes('Error generating commit message')) {\n    if (msg.includes('401')) fixApiKey();\n    else if (msg.includes('429')) await backoff();\n    // then retry apply\n  }\n}","preventionTips":["Send valid API keys/org id in ApplyPlanRequest or set them server-side","Use currently available models in plan settings (models deprecate)","Handle 429s with exponential backoff before retrying apply","Ensure server egress to the LLM provider is allowed"],"tags":["llm","api-key","openai","http"],"backgroundTag":"llm-api-call-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"}