plandex-ai/plandex · error

error getting plan settings: %v

Error message

error getting plan settings: %v

What it means

db.GetPlanSettings returned a non-nil error while loading settings for the plan in the tell flow's loader goroutine. The error is wrapped as 'error getting plan settings: %v' and sent on errCh, aborting the tell request before any LLM call.

Source

Thrown at app/server/model/plan/tell_load.go:81

		CancelFn: active.CancelFn,
		Reason:   "load tell plan",
	}, func(repo *db.GitRepo) error {
		errCh := make(chan error, 4)

		// get name for plan and rename if it's a draft
		go func() {
			defer func() {
				if r := recover(); r != nil {
					log.Printf("panic in getPlanSettings: %v\n%s", r, debug.Stack())
					errCh <- fmt.Errorf("panic getting plan settings: %v\n%s", r, debug.Stack())
					runtime.Goexit() // don't allow outer function to continue and double-send to channel
				}
			}()

			res, err := db.GetPlanSettings(plan)
			if err != nil {
				log.Printf("Error getting plan settings: %v\n", err)
				errCh <- fmt.Errorf("error getting plan settings: %v", err)
				return
			}
			settings = res

			orgUserConfigRes, err := db.GetOrgUserConfig(auth.User.Id, auth.OrgId)
			if err != nil {
				log.Printf("Error getting org user config: %v\n", err)
				errCh <- fmt.Errorf("error getting org user config: %v", err)
				return
			}
			orgUserConfig = orgUserConfigRes

			if plan.Name == "draft" {
				name, err := model.GenPlanName(
					auth,
					plan,
					settings,
					orgUserConfig,

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the wrapped DB error for connection vs missing-row causes
  2. Verify DB connectivity and that the plan row/settings exist
  3. Run pending schema migrations
  4. Retry the tell request if it was a transient DB/context failure

Example fix

// before
// settings row manually deleted
DELETE FROM plan_settings WHERE plan_id = 'abc';
// after: reset via app or recreate defaults
INSERT INTO plan_settings (plan_id, data) VALUES ('abc', '{}');
Defensive patterns

Strategy: retry

Validate before calling

if err := db.PingContext(ctx); err != nil {
    return fmt.Errorf("database unavailable: %w", err)
}
if !planSettingsExists(ctx, plan.Id) {
    return fmt.Errorf("no settings row for plan %s; initialize before Tell", plan.Id)
}

Try / catch

select {
case err := <-errCh:
    if strings.HasPrefix(err.Error(), "error getting plan settings:") {
        // retry transient DB errors with backoff; surface persistent ones
    }
case res := <-resCh:
    settings = res
}

Prevention

When it happens

Trigger: GetPlanSettings fails: DB connection failure, missing settings row for the plan ID, SQL syntax/permission error, or context cancellation while the query runs.

Common situations: Postgres down or connection pool exhausted; plan settings row deleted manually; schema migration mismatch after upgrade; plan canceled (context canceled) mid-load.

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/3963c5ed9cdd4489. Report an issue: GitHub.