dani-garcia/vaultwarden · error

Error loading groups for user

Error message

Error loading groups for user

What it means

Panic raised in GroupUser::find_by_member: the simple query selecting all groups_users rows for a given membership (users_organizations_uuid) is unwrapped with .expect(). A missing member yields an empty vec, so the panic only means the SQL execution failed - connection loss, schema drift in groups_users, or a diesel deserialization error - not an absent member.

Solutions

  1. Check the database connection and pool state when the panic occurs
  2. Confirm migrations are applied and groups_users matches the GroupUser model columns
  3. Log the underlying diesel error (available in the panic payload) to identify the SQL failure
  4. Swap .expect for .map_res to surface the failure as a normal ApiResult error
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/db/models/group.rs:517 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/65a10324d39d1ff4. Report an issue: GitHub.

Appendix: source

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

                    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,
    ) -> bool {
        conn.run(move |conn| {
            groups_users::table
                .inner_join(collections_groups::table.on(collections_groups::groups_uuid.eq(groups_users::groups_uuid)))
                .inner_join(groups::table.on(groups::uuid.eq(groups_users::groups_uuid)))
                .inner_join(
                    collections::table.on(collections::uuid
                        .eq(collections_groups::collections_uuid)
                        .and(collections::org_uuid.eq(groups::organizations_uuid))),
                )

View on GitHub (pinned to cc67d644f6)