RocketChat/Rocket.Chat · error · Meteor.Error

Error syncing user data

Error syncing user data

Error message

Error syncing user data

What it means

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.

Source

Thrown at apps/meteor/server/meteor-methods/auth/crowd.ts:78

			throw new Meteor.Error('error-not-authorized', 'Not authorized', {
				method: 'crowd_sync_users',
			});
		}

		try {
			const crowd = new CROWD();
			const startTime = Date.now();
			await crowd.sync();
			const stopTime = Date.now();
			const actual = Math.ceil((stopTime - startTime) / 1000);

			return {
				message: `User data synced in ${actual} seconds`,
				params: [],
			};
		} catch (err) {
			logger.error({ msg: 'Error syncing user data. ', err });
			throw new Meteor.Error('Error syncing user data', '', { method: 'crowd_sync_users' });
		}
	},
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Run crowd_test_connection first to confirm credentials and connectivity still work
  2. Open the server log and read the 'Error syncing user data.' entry to identify the underlying err
  3. Verify the Crowd application has permission to read users and groups
  4. After fixing the cause, retry; for recurring timeouts, sync off-peak or raise Crowd-side timeouts
Defensive patterns

Strategy: try-catch

Validate before calling

// cheap pre-flight: a passing connection test avoids most sync failures
try {
  await Meteor.callAsync('crowd_test_connection');
} catch {
  // fix connection/credentials before attempting the sync
}
await Meteor.callAsync('crowd_sync_users');

Type guard

const isMeteorErrorCode = (e: unknown, code: string): e is Meteor.Error => e instanceof Meteor.Error && e.error === code;

Try / catch

try {
  await Meteor.callAsync('crowd_sync_users');
} catch (err) {
  if (isMeteorErrorCode(err, 'Error syncing user data')) {
    // inspect the server log for the underlying err; retry only after fixing the cause
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Long-running syncs over a flaky VPN; credentials expired after a quarterly rotation; Crowd-side schema or directory permission changes breaking attribute reads.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/c0c08829ad64c6df. Report an issue: GitHub.