{"record":{"id":"c0c08829ad64c6df","repo":"RocketChat/Rocket.Chat","slug":"error-syncing-user-data","errorCode":"Error syncing user data","errorMessage":"Error syncing user data","messagePattern":"Error syncing user data","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/auth/crowd.ts","lineNumber":78,"sourceCode":"\t\t\tthrow new Meteor.Error('error-not-authorized', 'Not authorized', {\n\t\t\t\tmethod: 'crowd_sync_users',\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst crowd = new CROWD();\n\t\t\tconst startTime = Date.now();\n\t\t\tawait crowd.sync();\n\t\t\tconst stopTime = Date.now();\n\t\t\tconst actual = Math.ceil((stopTime - startTime) / 1000);\n\n\t\t\treturn {\n\t\t\t\tmessage: `User data synced in ${actual} seconds`,\n\t\t\t\tparams: [],\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tlogger.error({ msg: 'Error syncing user data. ', err });\n\t\t\tthrow new Meteor.Error('Error syncing user data', '', { method: 'crowd_sync_users' });\n\t\t}\n\t},\n});\n","sourceCodeStart":60,"sourceCodeEnd":82,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/auth/crowd.ts#L60-L82","documentation":"crowd_sync_users wraps crowd.sync(); any exception during the run (Crowd unreachable mid-sync, expired credentials, unexpected attribute shapes, timeouts) is logged as 'Error syncing user data.' with the original err, then rethrown as a generic Meteor.Error('Error syncing user data'). The thrown error carries no detail — the server log entry holds the actual cause.","triggerScenarios":"Crowd becomes unreachable or times out mid-run; the Crowd application password is revoked between connection and sync; the Crowd application lacks read permission on users/groups; a large directory exceeds request timeouts.","commonSituations":"Long-running syncs over a flaky VPN; credentials expired after a quarterly rotation; Crowd-side schema or directory permission changes breaking attribute reads.","solutions":["Run crowd_test_connection first to confirm credentials and connectivity still work","Open the server log and read the 'Error syncing user data.' entry to identify the underlying err","Verify the Crowd application has permission to read users and groups","After fixing the cause, retry; for recurring timeouts, sync off-peak or raise Crowd-side timeouts"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// cheap pre-flight: a passing connection test avoids most sync failures\ntry {\n  await Meteor.callAsync('crowd_test_connection');\n} catch {\n  // fix connection/credentials before attempting the sync\n}\nawait Meteor.callAsync('crowd_sync_users');","typeGuard":"const isMeteorErrorCode = (e: unknown, code: string): e is Meteor.Error => e instanceof Meteor.Error && e.error === code;","tryCatchPattern":"try {\n  await Meteor.callAsync('crowd_sync_users');\n} catch (err) {\n  if (isMeteorErrorCode(err, 'Error syncing user data')) {\n    // inspect the server log for the underlying err; retry only after fixing the cause\n  }\n}","preventionTips":["Run crowd_test_connection before every scheduled sync","Monitor the server log for the 'Error syncing user data.' entries to catch partial failures early","Keep Crowd credentials current and verify the application can read users and groups"],"tags":["crowd","sync","sso","network"],"backgroundTag":"sync-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}