dani-garcia/vaultwarden · error

Error loading group users

Error message

Error loading group users

What it means

This is a panic, not a returned error: inside GroupUser::find_by_group the diesel query joining groups_users, groups, and users_organizations is loaded with .expect(). It fires only when the database query itself fails - a broken/lost connection, schema mismatch between the groups_users table and the GroupUser model, or a SQL error - not when the group simply has no users (an empty vec is a valid result).

Solutions

  1. Check database connectivity and that the connection pool is healthy when this panics
  2. Verify the groups_users schema matches the GroupUser model (run migrations)
  3. Inspect the panic message/Debug output of the diesel error for the underlying SQL failure
  4. Replace .expect with .map_res so the failure is returned as an ApiError instead of aborting the task
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/db/models/group.rs:507 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dani-garcia/vaultwarden@cc67d644f6 (2026-09-19). Data as JSON: /api/errors/934b71b95cadc3b7. Report an issue: GitHub.

Appendix: source

Thrown at src/db/models/group.rs:507

                    .map_res("Error adding user to group")
            }
        }
    }

    pub async fn find_by_group(group_uuid: &GroupId, org_uuid: &OrganizationId, conn: &DbConn) -> Vec<Self> {
        conn.run(move |conn| {
            groups_users::table
                .inner_join(groups::table.on(groups::uuid.eq(groups_users::groups_uuid)))
                .inner_join(
                    users_organizations::table.on(users_organizations::uuid
                        .eq(groups_users::users_organizations_uuid)
                        .and(users_organizations::org_uuid.eq(groups::organizations_uuid))),
                )
                .filter(groups_users::groups_uuid.eq(group_uuid))
                .filter(groups::organizations_uuid.eq(org_uuid))
                .select(groups_users::all_columns)
                .load::<Self>(conn)
                .expect("Error loading group users")
        })
        .await
    }

    pub async fn find_by_member(member_uuid: &MembershipId, conn: &DbConn) -> Vec<Self> {
        conn.run(move |conn| {
            groups_users::table
                .filter(groups_users::users_organizations_uuid.eq(member_uuid))
                .load::<Self>(conn)
                .expect("Error loading groups for user")
        })
        .await
    }

    pub async fn has_access_to_collection_by_member(
        collection_uuid: &CollectionId,
        member_uuid: &MembershipId,
        conn: &DbConn,

View on GitHub (pinned to cc67d644f6)