RocketChat/Rocket.Chat · error · Meteor.Error

error-max-rooms-per-guest-reached

error-max-rooms-per-guest-reached

Error message

error-max-rooms-per-guest-reached

What it means

Enterprise licensing guard registered on the 'beforeAddedToRoom' callback: when the user being added to a room has the 'guest' role and License.shouldPreventAction('roomsPerGuest', 1, { userId }) returns true — i.e. adding one more room would exceed the license's rooms-per-guest limit — the add is blocked with this Meteor.Error whose message comes from the i18n key of the same name.

Solutions

  1. Remove the guest from a room they no longer need, then retry the add.
  2. Raise the roomsPerGuest limit in the license (work with sales/licensing) if the business requires more.
  3. Verify the user should actually have the 'guest' role — removing the role opts the user out of this check.
  4. Check the license status and limits in the admin license area to confirm the cap in force.
Defensive patterns

Strategy: validation

Validate before calling

if (user.roles?.includes('guest')) {
	if (await License.shouldPreventAction('roomsPerGuest', 1, { userId: user._id })) {
		// skip the add and inform the user instead of letting the callback throw
	}
}

Type guard

const isGuest = (user: { roles?: string[] }): boolean => !!user.roles?.includes('guest');

Try / catch

try {
	await addUserToRoom(rid, username);
} catch (e) {
	if (e instanceof Meteor.Error && e.error === 'error-max-rooms-per-guest-reached') {
		// surface 'remove the guest from another room first' to the caller
	}
	throw e;
}

Prevention

When it happens

Trigger: Any flow that adds a guest user to a room (addUserToRoom, room creation with members, team/channel invites) while that guest is already at the licensed roomsPerGuest cap.

Common situations: Guest users hitting the room cap of an Enterprise license; integrations auto-adding guests to many rooms; license downgrade lowering the cap below current usage.

Related errors


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

Appendix: source

Thrown at apps/meteor/ee/server/startup/maxRoomsPerGuest.ts:14

import { License } from '@rocket.chat/license';
import { Meteor } from 'meteor/meteor';

import { callbacks } from '../../../server/lib/callbacks';
import { i18n } from '../../../server/lib/i18n';

callbacks.add(
	'beforeAddedToRoom',
	async ({ user }) => {
		if (user.roles?.includes('guest')) {
			// extraCount = 1 checks if adding one more room would exceed the limit
			// (not if they've already exceeded it, since this runs before adding them to the room)
			if (await License.shouldPreventAction('roomsPerGuest', 1, { userId: user._id })) {
				throw new Meteor.Error('error-max-rooms-per-guest-reached', i18n.t('error-max-rooms-per-guest-reached'));
			}
		}
	},
	callbacks.priority.MEDIUM,
	'check-max-rooms-per-guest',
);

View on GitHub (pinned to b2c16d5842)