{"record":{"id":"cdce80d8b5612eb1","repo":"plandex-ai/plandex","slug":"error-checking-plan-model-settings-v","errorCode":null,"errorMessage":"error checking plan model settings: %v","messagePattern":"error checking plan model settings: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/models_sync.go","lineNumber":50,"sourceCode":"\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,\n\t\t\tfmt.Sprintf(\"%s → %s\", color.New(term.ColorHiCyan, color.Bold).Sprint(\"Plan model settings\"), GetPlanModelSettingsPath(CurrentPlanId)))\n\n\t\tonApprove = append(onApprove, SyncPlanModelSettings)\n\t}\n\n\tif len(changes) == 0 {\n\t\treturn nil\n\t}\n\n\tterm.StopSpinner()\n\tcolor.New(color.Bold, term.ColorHiYellow).Println(\"⚠️  Model settings have local changes\")\n\n\tfmt.Println()","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/models_sync.go#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix or restore the plan's model settings JSON at GetPlanModelSettingsPath(CurrentPlanId)","Re-select/switch the current plan (cd) so CurrentPlanId points at a healthy plan","Delete the corrupted plan settings file to regenerate it","Check file permissions in the plans directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"p := lib.GetPlanModelSettingsPath(lib.CurrentPlanId)\nif lib.CurrentPlanId == \"\" {\n\treturn fmt.Errorf(\"no current plan selected\")\n}\nif b, err := os.ReadFile(p); err == nil {\n\tvar v any\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn fmt.Errorf(\"plan model settings invalid at %s: %w\", p, err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := lib.PromptSyncModelsIfNeeded(); err != nil {\n\tif strings.Contains(err.Error(), \"error checking plan model settings\") {\n\t\t// reset plan settings file or re-select plan, then retry\n\t}\n\treturn err\n}","preventionTips":["Don't hand-edit per-plan settings files","Re-run plandex cd/init after switching machines or checkouts","Back up plan directories before manual cleanup","Delete only the corrupted settings file to regenerate it"],"tags":["go","config","json","plans"],"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"}