plandex-ai/plandex · error

Error listing users: {err.Error()}

Error message

Error listing users: {err.Error()}

What it means

After org checks pass, ListUsersHandler calls db.ListUsers(auth.OrgId) to enumerate all users belonging to the org. A query failure is returned as 500 with the raw error text: 'Error listing users: <err>'.

Source

Thrown at app/server/handlers/users.go:54

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

	if org.IsTrial {
		writeApiError(w, shared.ApiError{
			Type:   shared.ApiErrorTypeTrialActionNotAllowed,
			Status: http.StatusForbidden,
			Msg:    "Trial user can't list users",
		})
		return
	}

	users, err := db.ListUsers(auth.OrgId)
	if err != nil {
		log.Println("Error listing users: ", err)
		http.Error(w, "Error listing users: "+err.Error(), http.StatusInternalServerError)
		return
	}

	apiUsers := make([]*shared.User, 0, len(users))
	for _, user := range users {
		apiUsers = append(apiUsers, user.ToApi())
	}

	orgUsers, err := db.ListOrgUsers(auth.OrgId)
	if err != nil {
		log.Println("Error listing org users: ", err)
		http.Error(w, "Error listing org users: "+err.Error(), http.StatusInternalServerError)
		return
	}

	orgUsersByUserId := make(map[string]*shared.OrgUser)
	for _, orgUser := range orgUsers {
		orgUsersByUserId[orgUser.UserId] = orgUser.ToApi()

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the raw DB error in the response body or server log
  2. Verify the users table schema matches the User struct (run migrations)
  3. Check DB connection pool saturation and slow-query logs
  4. Retry; if timeouts recur for big orgs, investigate query performance/indexes
Defensive patterns

Strategy: retry

Try / catch

try {
  return await api.listUsers();
} catch (e) {
  if (e.status === 500 && /Error listing users/.test(e.message)) {
    await backoffRetry(() => api.listUsers(), 3);
  } else throw e;
}

Prevention

When it happens

Trigger: GET users list when the users query fails: DB unreachable, malformed join/query due to schema drift, users table locked, or context timeout during a large org listing.

Common situations: Migration mismatch between users table schema and the User struct tags; database connection saturation; slow query timing out for very large orgs.

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