plandex-ai/plandex · error

error checking plan model settings: %v

Error message

error checking plan model settings: %v

What it means

PromptSyncModelsIfNeeded wraps a failure from ModelSettingsCheckLocalChanges on the plan's model settings file. Means the local-changes check (hash/diff comparison against stored settings) itself errored, so the CLI cannot tell whether model settings need syncing before applying a plan.

Source

Thrown at app/cli/lib/models_sync.go:50

		onApprove = append(onApprove, SyncCustomModels)
	}

	defaultModelSettingsRes, err := ModelSettingsCheckLocalChanges(DefaultModelSettingsPath)
	if err != nil {
		return fmt.Errorf("error checking default model settings: %v", err)
	}

	if defaultModelSettingsRes.HasLocalChanges {
		changes = append(
			changes,
			fmt.Sprintf("%s → %s", color.New(term.ColorHiCyan, color.Bold).Sprint("Default model settings"), DefaultModelSettingsPath))

		onApprove = append(onApprove, SyncDefaultModelSettings)
	}

	planModelSettingsRes, err := ModelSettingsCheckLocalChanges(GetPlanModelSettingsPath(CurrentPlanId))
	if err != nil {
		return fmt.Errorf("error checking plan model settings: %v", err)
	}

	if planModelSettingsRes.HasLocalChanges {
		changes = append(
			changes,
			fmt.Sprintf("%s → %s", color.New(term.ColorHiCyan, color.Bold).Sprint("Plan model settings"), GetPlanModelSettingsPath(CurrentPlanId)))

		onApprove = append(onApprove, SyncPlanModelSettings)
	}

	if len(changes) == 0 {
		return nil
	}

	term.StopSpinner()
	color.New(color.Bold, term.ColorHiYellow).Println("⚠️  Model settings have local changes")

	fmt.Println()

View on GitHub (pinned to e2d772072e)

Solutions

  1. Fix or restore the plan's model settings JSON at GetPlanModelSettingsPath(CurrentPlanId)
  2. Re-select/switch the current plan (cd) so CurrentPlanId points at a healthy plan
  3. Delete the corrupted plan settings file to regenerate it
  4. Check file permissions in the plans directory
Defensive patterns

Strategy: validation

Validate before calling

p := lib.GetPlanModelSettingsPath(lib.CurrentPlanId)
if lib.CurrentPlanId == "" {
	return fmt.Errorf("no current plan selected")
}
if b, err := os.ReadFile(p); err == nil {
	var v any
	if err := json.Unmarshal(b, &v); err != nil {
		return fmt.Errorf("plan model settings invalid at %s: %w", p, err)
	}
}

Try / catch

if err := lib.PromptSyncModelsIfNeeded(); err != nil {
	if strings.Contains(err.Error(), "error checking plan model settings") {
		// reset plan settings file or re-select plan, then retry
	}
	return err
}

Prevention

When it happens

Trigger: ModelSettingsCheckLocalChanges errors for the current plan's settings path — missing/corrupt plan settings file, invalid JSON, or an I/O error; CurrentPlanId pointing at a plan whose files are damaged or deleted.

Common situations: Plan directory edited or partially synced manually; switching machines/checkouts so the plan settings file is stale or absent; a crashed write left truncated JSON.

Related errors


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