plandex-ai/plandex · error

Error generating commit message:

Error message

Error generating commit message: 

What it means

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.

Source

Thrown at app/server/handlers/plans_changes.go:215

	)

	clients := res.clients
	authVars := res.authVars

	commitMsg, err := modelPlan.GenCommitMsgForPendingResults(modelPlan.GenCommitMsgForPendingResultsParams{
		Auth:      auth,
		Plan:      plan,
		Clients:   clients,
		Settings:  settings,
		Current:   currentPlan,
		AuthVars:  authVars,
		SessionId: requestBody.SessionId,
		Ctx:       r.Context(),
	})

	if err != nil {
		log.Printf("Error generating commit message: %v\n", err)
		http.Error(w, "Error generating commit message: "+err.Error(), http.StatusInternalServerError)
		return
	}

	err = db.ExecRepoOperation(db.ExecRepoOperationParams{
		OrgId:          auth.OrgId,
		UserId:         auth.User.Id,
		PlanId:         planId,
		Branch:         branch,
		Scope:          db.LockScopeWrite,
		Ctx:            ctx,
		CancelFn:       cancel,
		ClearRepoOnErr: true,
	}, func(repo *db.GitRepo) error {
		return db.ApplyPlan(repo, ctx, db.ApplyPlanParams{
			OrgId:                  auth.OrgId,
			UserId:                 auth.User.Id,
			BranchName:             branch,
			Plan:                   plan,

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the appended error detail for the provider's status/message (401 => key, 429 => rate limit, 404 => model)
  2. Verify the API keys and openAIOrgId sent in ApplyPlanRequest are valid and funded
  3. Update the plan settings to a currently available model
  4. Retry after a provider outage/rate limit; consider setting a commit message manually if the feature allows

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling apply, confirm credentials are present
if (!apiKeys?.openai && !process.env.OPENAI_API_KEY) throw new Error('missing LLM API key');

Type guard

null

Try / catch

const res = await fetch(applyUrl, opts);
if (res.status === 500) {
  const msg = await res.text();
  if (msg.includes('Error generating commit message')) {
    if (msg.includes('401')) fixApiKey();
    else if (msg.includes('429')) await backoff();
    // then retry apply
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/c5a10ed8972f768b. Report an issue: GitHub.