plandex-ai/plandex · error

failed to check context conflicts: %v

Error message

failed to check context conflicts: %v

What it means

MustLoadContext wraps any error returned by checkContextConflicts with this message before invoking the onErr handler. It indicates the pre-flight check that detects conflicting context entries (e.g. overlapping or mutually exclusive file/directory loads) itself failed, so conflict status is unknown. The load is not aborted by this wrapper alone; the underlying error is the cause.

Source

Thrown at app/cli/lib/context_load.go:675

				InputSizes:  pathSizes,
				FilePath:    inputPath,
				AutoLoaded:  params.AutoLoaded,
			})

		}
	}

	filesToLoad := map[string]string{}
	for _, context := range loadContextReq {
		if context.ContextType == shared.ContextFileType {
			filesToLoad[context.FilePath] = context.Body
		}
	}

	hasConflicts, err := checkContextConflicts(filesToLoad)

	if err != nil {
		onErr(fmt.Errorf("failed to check context conflicts: %v", err))
	}

	if len(loadContextReq)+len(cachedMapPaths) == 0 {
		term.StopSpinner()
		fmt.Println("🤷‍♂️ No context loaded")

		didOutputReason := false
		if len(alreadyLoadedByComposite) > 0 {
			printAlreadyLoadedMsg(alreadyLoadedByComposite)
			didOutputReason = true
		}
		if len(ignoredPaths) > 0 && !params.SkipIgnoreWarning {
			printIgnoredMsg()
			didOutputReason = true
		}

		if !didOutputReason {
			fmt.Println()

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped %v cause to identify which file/stat operation failed
  2. Re-run the context load after verifying all resolved paths exist and are readable (ls/permissions)
  3. Remove stale context entries (plandex context clear or unload the missing files) and reload

Example fix

// before
hasConflicts, err := checkContextConflicts(filesToLoad)
if err != nil {
    onErr(fmt.Errorf("failed to check context conflicts: %v", err))
}
// after — skip the check when nothing to compare or log and continue
hasConflicts, err := checkContextConflicts(filesToLoad)
if err != nil && len(filesToLoad) > 0 {
    onErr(fmt.Errorf("failed to check context conflicts: %v", err))
}
Defensive patterns

Strategy: fallback

Validate before calling

for _, f := range filesToLoad {
    if _, err := os.Stat(f); err != nil {
        return fmt.Errorf("context file %s is not accessible: %w", f, err)
    }
}

Try / catch

hasConflicts, err := checkContextConflicts(filesToLoad)
if err != nil {
    // degrade gracefully: assume no conflicts and surface a warning
    fmt.Printf("warning: conflict check skipped: %v\n", err)
    hasConflicts = false
}

Prevention

When it happens

Trigger: Calling contextLoad, new, or MustLoadAutoContextMap while checkContextConflicts(filesToLoad) returns an error — typically filesystem/stat failures while examining the resolved file list, or malformed entries in filesToLoad.

Common situations: Files deleted or permission-denied between resolution and conflict check; symlinks to unreadable locations; a context file path that no longer exists on disk.

Related errors


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