{"record":{"id":"2e1a5937109654d4","repo":"dani-garcia/vaultwarden","slug":"error-loading-groups","errorCode":null,"errorMessage":"Error loading groups","messagePattern":"Error loading groups","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/db/models/group.rs","lineNumber":202,"sourceCode":"                    .execute(conn)\n                    .map_res(\"Error saving group\")\n            }\n        }\n    }\n\n    pub async fn delete_all_by_organization(org_uuid: &OrganizationId, conn: &DbConn) -> EmptyResult {\n        for group in Self::find_by_organization(org_uuid, conn).await {\n            group.delete(org_uuid, conn).await?;\n        }\n        Ok(())\n    }\n\n    pub async fn find_by_organization(org_uuid: &OrganizationId, conn: &DbConn) -> Vec<Self> {\n        conn.run(move |conn| {\n            groups::table\n                .filter(groups::organizations_uuid.eq(org_uuid))\n                .load::<Self>(conn)\n                .expect(\"Error loading groups\")\n        })\n        .await\n    }\n\n    pub async fn count_by_org(org_uuid: &OrganizationId, conn: &DbConn) -> i64 {\n        conn.run(move |conn| {\n            groups::table.filter(groups::organizations_uuid.eq(org_uuid)).count().first::<i64>(conn).ok().unwrap_or(0)\n        })\n        .await\n    }\n\n    pub async fn find_by_uuid_and_org(uuid: &GroupId, org_uuid: &OrganizationId, conn: &DbConn) -> Option<Self> {\n        conn.run(move |conn| {\n            groups::table\n                .filter(groups::uuid.eq(uuid))\n                .filter(groups::organizations_uuid.eq(org_uuid))\n                .first::<Self>(conn)\n                .ok()","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/dani-garcia/vaultwarden/blob/cc67d644f62605cb46f4d16c4a2eed1a861cc8bb/src/db/models/group.rs#L184-L220","documentation":"Panic from `.expect()` on the Diesel `load` in `Group::find_by_organization`. The query listing all groups in an organization failed at the database layer, aborting the task. An org with zero groups returns an empty Vec; only genuine DB errors trigger this message.","triggerScenarios":"Calling `Group::find_by_organization` with an unreachable DB, the `groups` table missing (pre-groups schema), or `organizations_uuid` column missing/renamed.","commonSituations":"Upgrading an old instance whose schema predates the groups feature without applying migrations; DB outage during an org management request; SQLite file locked.","solutions":["Apply all pending migrations so the groups table exists","Verify DB connectivity and DATABASE_URL credentials","Check server logs for the underlying Diesel error","Restore the groups table from backup if schema was manually altered"],"exampleFix":"// before\n.load::<Self>(conn).expect(\"Error loading groups\")\n// after\n.load::<Self>(conn).unwrap_or_else(|e| { error!(\"load groups failed: {e}\"); Vec::new() })","handlingStrategy":"try-catch","validationCode":"// verify groups table exists (schema supports groups feature)\n// SELECT 1 FROM groups LIMIT 1;","typeGuard":null,"tryCatchPattern":"// schema-gate before org group queries\nif !schema_has_groups().await { return Vec::new(); }\nGroup::find_by_organization(org_uuid, conn).await","preventionTips":["Upgrade via official migration path so the groups feature tables are created","Do not skip minor-version migrations","Verify DB reachability before bulk org operations","Restore schema from backup after accidental drops"],"tags":["database","panic","groups"],"backgroundTag":"database-query-failed","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"}