RocketChat/Rocket.Chat · error · Meteor.Error
error-user-limit-exceeded
error-user-limit-exceeded
Error message
User Limit Exceeded
What it means
Before adding anyone, addAllUserToRoomFn loads all users (only active ones when activeUsersOnly=true) and compares the count to the API_User_Limit setting. If the workspace has more users than that setting allows, it throws error-user-limit-exceeded - a safety valve against an unbounded storm of subscription writes and 'uj' system messages that could stall a large server.
Source
Thrown at apps/meteor/server/meteor-methods/rooms/addAllUserToRoom.ts:43
check(rid, String);
check(activeUsersOnly, Boolean);
if (!(await hasPermissionAsync(userId, 'add-all-to-room'))) {
throw new Meteor.Error(403, 'Access to Method Forbidden', {
method: 'addAllToRoom',
});
}
const userFilter: {
active?: boolean;
} = {};
if (activeUsersOnly === true) {
userFilter.active = true;
}
const users = await Users.find(userFilter).toArray();
if (users.length > settings.get<number>('API_User_Limit')) {
throw new Meteor.Error('error-user-limit-exceeded', 'User Limit Exceeded', {
method: 'addAllToRoom',
});
}
const room = await Rooms.findOneById(rid);
if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', {
method: 'addAllToRoom',
});
}
await beforeAddUserToRoom(
users.map((u) => u.username!),
room,
);
const now = new Date();
for await (const user of users) {View on GitHub (pinned to b2c16d5842)
Solutions
- Raise the API_User_Limit setting above the workspace user count, sizing for the resulting N subscription writes and system messages.
- Pass activeUsersOnly=true so only active users are counted and added.
- On very large servers, add specific users instead (channels.invite / addUserToRoom).
Example fix
// before
await Meteor.callAsync('addAllUserToRoom', rid, false);
// after
// only bulk-add when the active population fits the configured limit
await Meteor.callAsync('addAllUserToRoom', rid, true); Defensive patterns
Strategy: validation
Validate before calling
// preflight: compare workspace user count against the limit before bulk-adding
const stats = await fetch('/api/v1/statistics', { headers }).then((r) => r.json());
const totalUsers = stats.statistics?.totalUsers ?? 0;
if (totalUsers > Number(apiUserLimit)) {
throw new Error('Workspace exceeds API_User_Limit - raise the setting or add users individually');
} Try / catch
try {
await Meteor.callAsync('addAllUserToRoom', rid, true);
} catch (e: any) {
if (e?.error === 'error-user-limit-exceeded') {
// ask the operator to raise API_User_Limit or use targeted invites
}
} Prevention
- Keep API_User_Limit aligned with actual workspace size when bulk adds are expected.
- Default to activeUsersOnly=true so deactivated accounts do not count.
- For large servers, prefer targeted invites over bulk add.
When it happens
Trigger: Calling addAllUserToRoom (or channels.addAll/groups.addAll) on a server whose total user count exceeds API_User_Limit; passing activeUsersOnly=false counts deactivated users too, making the limit easier to hit.
Common situations: Growing communities where API_User_Limit was left at a low default; operators forgetting activeUsersOnly=true; imported user bases that inflate the count.
Related errors
- error-direct-message-max-user-exceeded
- Federation configuration is invalid,unable to change room ow
- error-max-rooms-per-guest-reached
- invalid-channel
- The required "roomId" or "roomName" param provided does not
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/245edda610859b39.
Report an issue: GitHub.