{"record":{"id":"65a10324d39d1ff4","repo":"dani-garcia/vaultwarden","slug":"error-loading-groups-for-user","errorCode":null,"errorMessage":"Error loading groups for user","messagePattern":"Error loading groups for user","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/db/models/group.rs","lineNumber":517,"sourceCode":"                    users_organizations::table.on(users_organizations::uuid\n                        .eq(groups_users::users_organizations_uuid)\n                        .and(users_organizations::org_uuid.eq(groups::organizations_uuid))),\n                )\n                .filter(groups_users::groups_uuid.eq(group_uuid))\n                .filter(groups::organizations_uuid.eq(org_uuid))\n                .select(groups_users::all_columns)\n                .load::<Self>(conn)\n                .expect(\"Error loading group users\")\n        })\n        .await\n    }\n\n    pub async fn find_by_member(member_uuid: &MembershipId, conn: &DbConn) -> Vec<Self> {\n        conn.run(move |conn| {\n            groups_users::table\n                .filter(groups_users::users_organizations_uuid.eq(member_uuid))\n                .load::<Self>(conn)\n                .expect(\"Error loading groups for user\")\n        })\n        .await\n    }\n\n    pub async fn has_access_to_collection_by_member(\n        collection_uuid: &CollectionId,\n        member_uuid: &MembershipId,\n        conn: &DbConn,\n    ) -> bool {\n        conn.run(move |conn| {\n            groups_users::table\n                .inner_join(collections_groups::table.on(collections_groups::groups_uuid.eq(groups_users::groups_uuid)))\n                .inner_join(groups::table.on(groups::uuid.eq(groups_users::groups_uuid)))\n                .inner_join(\n                    collections::table.on(collections::uuid\n                        .eq(collections_groups::collections_uuid)\n                        .and(collections::org_uuid.eq(groups::organizations_uuid))),\n                )","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/dani-garcia/vaultwarden/blob/cc67d644f62605cb46f4d16c4a2eed1a861cc8bb/src/db/models/group.rs#L499-L535","documentation":"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.","triggerScenarios":"Thrown at src/db/models/group.rs:517 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the database connection and pool state when the panic occurs","Confirm migrations are applied and groups_users matches the GroupUser model columns","Log the underlying diesel error (available in the panic payload) to identify the SQL failure","Swap .expect for .map_res to surface the failure as a normal ApiResult error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cc67d644f62605cb46f4d16c4a2eed1a861cc8bb","analyzedAt":"2026-09-19T08:28:46.370Z","contentChangedAt":"2026-09-19T08:28:46.370Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}