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
- Read the wrapped inner error to identify which sync step failed (custom models vs default vs plan settings)
- Re-authenticate if the inner error is an API/auth failure
- Fix the offending local file (JSON validity, permissions) and re-run
- 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
- Unwrap the error chain to find the failing sync step
- Ensure stable connectivity and fresh auth before approving sync
- Keep local model/settings files valid so sync steps don't fail midway
- Retry sync once after transient network errors
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
- error getting server models input: %v
- error rejecting result: %v
- error rejecting plan: %v
- connection to plan stream timed out due to missing heartbeat
- error loading accounts: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/6be4facb35461acf.
Report an issue: GitHub.