{"record":{"id":"368088d4b0f343be","repo":"plandex-ai/plandex","slug":"error-checking-default-model-settings-v","errorCode":null,"errorMessage":"error checking default model settings: %v","messagePattern":"error checking default model settings: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/models_sync.go","lineNumber":37,"sourceCode":"\n\tcustomModelsPath := GetCustomModelsPath(userId)\n\n\tcustomModelsRes, err := CustomModelsCheckLocalChanges(customModelsPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error checking custom models: %v\", err)\n\t}\n\n\tif customModelsRes.HasLocalChanges {\n\t\tchanges = append(\n\t\t\tchanges,\n\t\t\tfmt.Sprintf(\"%s → %s\", color.New(term.ColorHiCyan, color.Bold).Sprint(\"Custom models\"), customModelsPath))\n\n\t\tonApprove = append(onApprove, SyncCustomModels)\n\t}\n\n\tdefaultModelSettingsRes, err := ModelSettingsCheckLocalChanges(DefaultModelSettingsPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error checking default model settings: %v\", err)\n\t}\n\n\tif defaultModelSettingsRes.HasLocalChanges {\n\t\tchanges = append(\n\t\t\tchanges,\n\t\t\tfmt.Sprintf(\"%s → %s\", color.New(term.ColorHiCyan, color.Bold).Sprint(\"Default model settings\"), DefaultModelSettingsPath))\n\n\t\tonApprove = append(onApprove, SyncDefaultModelSettings)\n\t}\n\n\tplanModelSettingsRes, err := ModelSettingsCheckLocalChanges(GetPlanModelSettingsPath(CurrentPlanId))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error checking plan model settings: %v\", err)\n\t}\n\n\tif planModelSettingsRes.HasLocalChanges {\n\t\tchanges = append(\n\t\t\tchanges,","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/models_sync.go#L19-L55","documentation":"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.","triggerScenarios":"ModelSettingsCheckLocalChanges errors on DefaultModelSettingsPath — unreadable file, malformed JSON, or schema mismatch while computing local changes.","commonSituations":"Default model settings edited by hand or by a newer CLI version; file corrupted by an interrupted write; permission issues on the config directory.","solutions":["Validate/fix the JSON at DefaultModelSettingsPath","Reset the default model settings file to a known-good copy","Check permissions on the file and its directory","Upgrade or downgrade the CLI so the file version matches the binary"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if b, err := os.ReadFile(lib.DefaultModelSettingsPath); err == nil {\n\tvar v any\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn fmt.Errorf(\"default model settings invalid: %w\", err)\n\t}\n} else if !os.IsNotExist(err) {\n\treturn fmt.Errorf(\"cannot read default model settings: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := lib.PromptSyncModelsIfNeeded(); err != nil {\n\tif strings.Contains(err.Error(), \"error checking default model settings\") {\n\t\t// restore or reset DefaultModelSettingsPath, then retry\n\t}\n\treturn err\n}","preventionTips":["Let the CLI write settings files; avoid manual edits","Validate JSON after any edit","Restore defaults after CLI version upgrades","Check directory permissions when moving HOME"],"tags":["go","config","json","file-io"],"backgroundTag":"config-file-parse-error","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}