plandex-ai/plandex · error

error committing changes: %v

Error message

error committing changes: %v

What it means

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.

Source

Thrown at app/server/handlers/context_helper.go:274

		for _, context := range dbContexts {
			if context.ContextType == shared.ContextMapType {
				mapContextsCount++
				log.Printf("[ContextHelper] Loaded map context: %s, path: %s, tokens: %d", context.Name, context.FilePath, context.NumTokens)
			}
		}
		if mapContextsCount > 0 {
			log.Printf("[ContextHelper] Successfully loaded %d map contexts out of %d total contexts", mapContextsCount, len(dbContexts))
		}

		if loadRes.MaxTokensExceeded {
			return nil
		}

		log.Printf("[ContextHelper] Committing changes to branch %s", branchName)
		err = repo.GitAddAndCommit(branchName, res.Msg)

		if err != nil {
			return fmt.Errorf("error committing changes: %v", err)
		}

		log.Printf("[ContextHelper] Committing changes to branch %s completed successfully", branchName)

		return nil
	})

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

	if loadRes.MaxTokensExceeded {
		log.Printf("The total number of tokens (%d) exceeds the maximum allowed (%d)", loadRes.TotalTokens, loadRes.MaxTokens)
		bytes, err := json.Marshal(loadRes)

		if err != nil {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped GitAddAndCommit error for git's output
  2. Check for a stale index.lock in the plan repo
  3. Verify repo integrity (git status/fsck) and retry the commit
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at app/server/handlers/context_helper.go:274 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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