plandex-ai/plandex · error

error checking default model settings: %v

Error message

error checking default model settings: %v

What it means

PromptSyncModelsIfNeeded checks the default model settings file via ModelSettingsCheckLocalChanges(DefaultModelSettingsPath) and wraps failures as 'error checking default model settings: %v', meaning that file couldn't be read or validated.

Source

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

	customModelsPath := GetCustomModelsPath(userId)

	customModelsRes, err := CustomModelsCheckLocalChanges(customModelsPath)
	if err != nil {
		return fmt.Errorf("error checking custom models: %v", err)
	}

	if customModelsRes.HasLocalChanges {
		changes = append(
			changes,
			fmt.Sprintf("%s → %s", color.New(term.ColorHiCyan, color.Bold).Sprint("Custom models"), customModelsPath))

		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,

View on GitHub (pinned to e2d772072e)

Solutions

  1. Validate/fix the JSON at DefaultModelSettingsPath
  2. Reset the default model settings file to a known-good copy
  3. Check permissions on the file and its directory
  4. Upgrade or downgrade the CLI so the file version matches the binary
Defensive patterns

Strategy: validation

Validate before calling

if b, err := os.ReadFile(lib.DefaultModelSettingsPath); err == nil {
	var v any
	if err := json.Unmarshal(b, &v); err != nil {
		return fmt.Errorf("default model settings invalid: %w", err)
	}
} else if !os.IsNotExist(err) {
	return fmt.Errorf("cannot read default model settings: %w", err)
}

Try / catch

if err := lib.PromptSyncModelsIfNeeded(); err != nil {
	if strings.Contains(err.Error(), "error checking default model settings") {
		// restore or reset DefaultModelSettingsPath, then retry
	}
	return err
}

Prevention

When it happens

Trigger: ModelSettingsCheckLocalChanges errors on DefaultModelSettingsPath — unreadable file, malformed JSON, or schema mismatch while computing local changes.

Common situations: Default model settings edited by hand or by a newer CLI version; file corrupted by an interrupted write; permission issues on the config directory.

Related errors


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