plandex-ai/plandex · error

error syncing models: %v

Error message

error syncing models: %v

What it means

Once the user approves, PromptSyncModelsIfNeeded runs each queued sync function (SyncCustomModels, SyncDefaultModelSettings, etc.) and wraps any of their failures as 'error syncing models: %v'. The root cause lives in the wrapped inner error.

Source

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

	fmt.Println()
	for _, change := range changes {
		fmt.Println(change)
	}
	fmt.Println()

	shouldSave, err := term.ConfirmYesNo("Save changes now?")
	if err != nil {
		return fmt.Errorf("error confirming: %v", err)
	}

	if !shouldSave {
		return nil
	}

	for _, fn := range onApprove {
		err := fn()
		if err != nil {
			return fmt.Errorf("error syncing models: %v", err)
		}
	}

	return nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped inner error to identify which sync step failed (custom models vs default vs plan settings)
  2. Re-authenticate if the inner error is an API/auth failure
  3. Fix the offending local file (JSON validity, permissions) and re-run
  4. Retry the sync after restoring connectivity
Defensive patterns

Strategy: try-catch

Validate before calling

if auth.Current.UserId == "" {
	return fmt.Errorf("login required before model sync")
}
// verify connectivity
if err := pingAPI(api.Client); err != nil {
	return fmt.Errorf("API unreachable before sync: %w", err)
}

Try / catch

if err := lib.PromptSyncModelsIfNeeded(); err != nil {
	var root error = err
	// unwrap to find which sync step failed
	for unwrapped := errors.Unwrap(root); unwrapped != nil; unwrapped = errors.Unwrap(root) {
		root = unwrapped
	}
	log.Printf("model sync failed, root cause: %v", root)
	return err
}

Prevention

When it happens

Trigger: Any onApprove function returns an error — e.g. ApplyModelSettings failure (250), UpdateOrgDefaultSettings API failure (251), or custom models sync errors — during the post-approval loop.

Common situations: Expired API session mid-sync; corrupted local model/settings files that passed the change check but fail on write; network drop during sync.

Related errors


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