plandex-ai/plandex · error
Error listing org users: {err.Error()}
Error message
Error listing org users: {err.Error()} What it means
ListUsersHandler then calls db.ListOrgUsers(auth.OrgId) to fetch org-membership records, mapping them by UserId for the response. A failure here returns 500 'Error listing org users: <err>' with the raw DB error appended.
Source
Thrown at app/server/handlers/users.go:66
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()
}
resp := shared.ListUsersResponse{
Users: apiUsers,
OrgUsersByUserId: orgUsersByUserId,
}
bytes, err := json.Marshal(resp)
if err != nil {
log.Println("Error marshalling users: ", err)
http.Error(w, "Error marshalling users: "+err.Error(), http.StatusInternalServerError)View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the raw DB error in the response body or server log
- Run pending migrations so org_users schema matches the code
- Clean up orphaned org_users rows pointing at deleted users
- Verify DB health and retry the request
Defensive patterns
Strategy: retry
Try / catch
try {
return await api.listUsers();
} catch (e) {
if (e.status === 500 && /Error listing org users/.test(e.message)) {
await backoffRetry(() => api.listUsers(), 3);
} else throw e;
} Prevention
- Use ON DELETE CASCADE or cleanup jobs for org_users rows
- Keep org_users migrations in sync with deploys
- Check server logs for the raw DB error appended to the 500 body
- Retry transient DB failures with backoff
When it happens
Trigger: GET users list when the org_users query fails: DB down, org_users table schema drift, foreign-key rows referencing deleted users, or connection/context issues mid-request.
Common situations: Orphaned org_users rows after user deletion without cascading cleanup; unapplied migrations altering the org_users table; transient DB connectivity loss during the request.
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
- error getting current plan state params: %v
- error getting contexts: %v
- error loading plan: %v
- error validating project
- error validating plan membership
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/ef082799bdba06fa.
Report an issue: GitHub.