{"record":{"id":"53810481195a5ae0","repo":"plandex-ai/plandex","slug":"error-getting-plan-settings-538104","errorCode":null,"errorMessage":"Error getting plan settings","messagePattern":"Error getting plan settings","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/plans_exec.go","lineNumber":45,"sourceCode":"\tif auth == nil {\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tplanId := vars[\"planId\"]\n\tbranch := vars[\"branch\"]\n\n\tlog.Println(\"planId: \", planId)\n\n\tplan := authorizePlanExecUpdate(w, planId, auth)\n\tif plan == nil {\n\t\treturn\n\t}\n\n\tsettings, err := db.GetPlanSettings(plan)\n\tif err != nil {\n\t\tlog.Printf(\"Error getting plan settings: %v\\n\", err)\n\t\thttp.Error(w, \"Error getting plan settings\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading request body: %v\\n\", err)\n\t\tgo notify.NotifyErr(notify.SeverityError, fmt.Errorf(\"error reading request body: %v\", err))\n\t\thttp.Error(w, \"Error reading request body\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer func() {\n\t\tlog.Println(\"Closing request body\")\n\t\tr.Body.Close()\n\t}()\n\n\tvar requestBody shared.TellPlanRequest\n\tif err := json.Unmarshal(body, &requestBody); err != nil {\n\t\tlog.Printf(\"Error parsing request body: %v\\n\", err)","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/plans_exec.go#L27-L63","documentation":"A 500 returned by TellPlanHandler when db.GetPlanSettings(plan) fails. GetPlanSettings loads (and if needed creates) the plan's settings record, including model/context defaults; a database error or failure resolving the plan's settings row surfaces here. Note the response body omits the underlying error detail (it is only logged server-side).","triggerScenarios":"Calling the tell endpoint on a plan whose settings row is missing/corrupt, Postgres is unreachable, or the settings insert/update inside GetPlanSettings fails (constraint violation, timeout, migration drift).","commonSituations":"Database down or restarting; partially applied migrations leaving plan_settings rows absent; settings row referencing a removed model pack after an upgrade; disk-full or pool-exhausted Postgres.","solutions":["Check server logs — the real cause is printed after 'Error getting plan settings: %v'","Verify Postgres connectivity and that the plan's settings table/row exists","Run pending migrations; after a version upgrade, confirm model pack references in settings are still valid","Retry; if persistent, recreate the plan or restore the settings row from backup"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify the plan is reachable before telling it\nconst plan = await getPlan(planId); // will 404/500 early if DB is broken\nif (!plan) throw new Error(`plan ${planId} unavailable`);","typeGuard":"function isTellablePlan(plan) {\n  return plan != null && typeof plan.id === 'string' && plan.id.length > 0;\n}","tryCatchPattern":"try {\n  await api.tell(planId, branch, body);\n} catch (err) {\n  if (err.status === 500 && err.message === 'Error getting plan settings') {\n    // detail is only in server logs; back off and retry\n    await sleep(retryDelay); return retry();\n  }\n  throw err;\n}","preventionTips":["Keep plan_settings schema migrations current with the server version","Ensure Postgres is up before sending tell requests","After upgrading, verify model pack references in plan settings still exist","Grab the '%v' detail from server logs — the HTTP body omits the cause"],"tags":["database","http-500","plan-settings","plandex-server"],"backgroundTag":"database-query-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}