plandex-ai/plandex · error

failed to check context conflicts: %v

Error message

failed to check context conflicts: %v

What it means

Before applying an update, UpdateContext calls checkContextConflicts on all file-type contexts being updated or deleted to detect pending local changes that would conflict. If that internal check itself errors (not merely reports conflicts), the update aborts with this wrapper.

Source

Thrown at app/cli/lib/context_update.go:262

	}

	filesToLoad := map[string]string{}
	for id := range req {
		context := contextsById[id]
		if context.ContextType == shared.ContextFileType {
			filesToLoad[context.FilePath] = context.Body
		}
	}
	for id := range deleteIds {
		context := contextsById[id]
		if context.ContextType == shared.ContextFileType {
			filesToLoad[context.FilePath] = ""
		}
	}

	hasConflicts, err = checkContextConflicts(filesToLoad)
	if err != nil {
		return UpdateContextResult{}, fmt.Errorf("failed to check context conflicts: %v", err)
	}

	if len(req) > 0 {
		res, apiErr := api.Client.UpdateContext(CurrentPlanId, CurrentBranch, req)
		if apiErr != nil {
			return UpdateContextResult{}, fmt.Errorf("failed to update context: %v", apiErr)
		}
		msg = res.Msg
	}

	if len(deleteIds) > 0 {
		res, apiErr := api.Client.DeleteContext(CurrentPlanId, CurrentBranch, shared.DeleteContextRequest{
			Ids: deleteIds,
		})
		if apiErr != nil {
			return UpdateContextResult{}, fmt.Errorf("failed to delete contexts: %v", apiErr)
		}
		msg += " " + res.Msg

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the wrapped error for the failing path and fix its readability/existence
  2. Remove and re-add the problematic context entry (plandex context rm / plandex load)
  3. Re-run the command; transient races usually clear on retry
  4. If it persists on a specific file, report a bug with the file type and error

Example fix

// before: failing whole update on one unreadable file
hasConflicts, err := lib.UpdateContext(params)
// after: pre-validate files to load and drop broken ones
for _, c := range contexts {
    if c.ContextType == shared.ContextFileType {
        if _, err := os.Stat(c.FilePath); err != nil {
            fmt.Printf("removing missing context %s (%s)\n", c.Id, c.FilePath)
        }
    }
}
hasConflicts, err := lib.UpdateContext(params)
Defensive patterns

Strategy: validation

Validate before calling

for _, c := range contexts {
    if c.ContextType == shared.ContextFileType {
        if fi, err := os.Stat(c.FilePath); err != nil || fi.IsDir() {
            return fmt.Errorf("context file %s not a readable file", c.FilePath)
        }
    }
}

Try / catch

res, err := lib.UpdateContext(params)
if err != nil && strings.Contains(err.Error(), "failed to check context conflicts") {
    return fmt.Errorf("conflict check failed; fix file access and retry: %w", err)
}

Prevention

When it happens

Trigger: checkContextConflicts fails while reading/hash-checking filesToLoad — typically filesystem errors on context file paths (unreadable, removed mid-check), or an internal error in the diff/sha computation.

Common situations: Race: a file deleted between listing and conflict check; permission-restricted files; very large files causing read errors; a bug in the conflict checker on unusual file content.

Related errors


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