plandex-ai/plandex · error

Error getting plan settings

Error message

Error getting plan settings

What it means

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).

Source

Thrown at app/server/handlers/plans_exec.go:45

	if auth == nil {
		return
	}

	vars := mux.Vars(r)
	planId := vars["planId"]
	branch := vars["branch"]

	log.Println("planId: ", planId)

	plan := authorizePlanExecUpdate(w, planId, auth)
	if plan == nil {
		return
	}

	settings, err := db.GetPlanSettings(plan)
	if err != nil {
		log.Printf("Error getting plan settings: %v\n", err)
		http.Error(w, "Error getting plan settings", http.StatusInternalServerError)
		return
	}

	body, err := io.ReadAll(r.Body)
	if err != nil {
		log.Printf("Error reading request body: %v\n", err)
		go notify.NotifyErr(notify.SeverityError, fmt.Errorf("error reading request body: %v", err))
		http.Error(w, "Error reading request body", http.StatusInternalServerError)
		return
	}
	defer func() {
		log.Println("Closing request body")
		r.Body.Close()
	}()

	var requestBody shared.TellPlanRequest
	if err := json.Unmarshal(body, &requestBody); err != nil {
		log.Printf("Error parsing request body: %v\n", err)

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check server logs — the real cause is printed after 'Error getting plan settings: %v'
  2. Verify Postgres connectivity and that the plan's settings table/row exists
  3. Run pending migrations; after a version upgrade, confirm model pack references in settings are still valid
  4. Retry; if persistent, recreate the plan or restore the settings row from backup
Defensive patterns

Strategy: retry

Validate before calling

// verify the plan is reachable before telling it
const plan = await getPlan(planId); // will 404/500 early if DB is broken
if (!plan) throw new Error(`plan ${planId} unavailable`);

Type guard

function isTellablePlan(plan) {
  return plan != null && typeof plan.id === 'string' && plan.id.length > 0;
}

Try / catch

try {
  await api.tell(planId, branch, body);
} catch (err) {
  if (err.status === 500 && err.message === 'Error getting plan settings') {
    // detail is only in server logs; back off and retry
    await sleep(retryDelay); return retry();
  }
  throw err;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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