plandex-ai/plandex · error

error getting org user config: %v

Error message

error getting org user config: %v

What it means

db.GetOrgUserConfig failed while fetching the org-scoped user configuration (model defaults, settings overrides) for the requesting user/org during tell plan loading. The wrapped error is sent on errCh and the tell flow aborts.

Source

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

				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,
					clients,
					authVars,
					req.Prompt,
					active.SessionId,
					active.Ctx,
				)

				if err != nil {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Verify the user still belongs to the org and the org user config exists (re-save org settings to initialize it)
  2. Check DB connectivity and migration state
  3. Re-authenticate so auth.User.Id matches a valid org member
  4. Retry if the wrapped error indicates a transient failure

Example fix

// before
// user removed from org, config row gone
// after: re-add member so GetOrgUserConfig resolves
INSERT INTO org_user_config (org_id, user_id, data) VALUES ('org1', 'user1', '{}');
Defensive patterns

Strategy: retry

Validate before calling

if err := db.PingContext(ctx); err != nil {
    return fmt.Errorf("database unavailable: %w", err)
}
if !orgUserConfigExists(ctx, auth.User.Id, auth.OrgId) {
    return fmt.Errorf("no org user config for user %s in org %s; initialize it first", auth.User.Id, auth.OrgId)
}

Try / catch

select {
case err := <-errCh:
    if strings.HasPrefix(err.Error(), "error getting org user config:") {
        // re-init org user config or retry on transient DB error
    }
case res := <-resCh:
    orgUserConfig = res
}

Prevention

When it happens

Trigger: GetOrgUserConfig(auth.User.Id, auth.OrgId) errors: user row missing for the org, DB outage, permission error, or context cancellation.

Common situations: User removed from org but session still active; fresh org without initialized user config; DB connectivity issues; auth token for a stale user ID.

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/6797d9d45cf523eb. Report an issue: GitHub.