{"record":{"id":"546a750ccf3ec624","repo":"RocketChat/Rocket.Chat","slug":"error-max-rooms-per-guest-reached","errorCode":"error-max-rooms-per-guest-reached","errorMessage":"error-max-rooms-per-guest-reached","messagePattern":"error-max-rooms-per-guest-reached","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/startup/maxRoomsPerGuest.ts","lineNumber":14,"sourceCode":"import { License } from '@rocket.chat/license';\nimport { Meteor } from 'meteor/meteor';\n\nimport { callbacks } from '../../../server/lib/callbacks';\nimport { i18n } from '../../../server/lib/i18n';\n\ncallbacks.add(\n\t'beforeAddedToRoom',\n\tasync ({ user }) => {\n\t\tif (user.roles?.includes('guest')) {\n\t\t\t// extraCount = 1 checks if adding one more room would exceed the limit\n\t\t\t// (not if they've already exceeded it, since this runs before adding them to the room)\n\t\t\tif (await License.shouldPreventAction('roomsPerGuest', 1, { userId: user._id })) {\n\t\t\t\tthrow new Meteor.Error('error-max-rooms-per-guest-reached', i18n.t('error-max-rooms-per-guest-reached'));\n\t\t\t}\n\t\t}\n\t},\n\tcallbacks.priority.MEDIUM,\n\t'check-max-rooms-per-guest',\n);\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/startup/maxRoomsPerGuest.ts#L1-L21","documentation":"Thrown by the 'beforeAddedToRoom' callback registered in maxRoomsPerGuest when a guest user is about to be added to a room and License.shouldPreventAction('roomsPerGuest', 1, ...) returns true. This is an Enterprise license enforcement: it caps how many rooms a single guest can belong to. The extraCount of 1 simulates the additional room, so it triggers before the guest actually exceeds the cap.","triggerScenarios":"Adding a guest user to a new omnichannel room when their current room count is already at the licensed roomsPerGuest limit; the workspace has an Enterprise license with a per-guest room cap configured.","commonSituations":"Guest user already in the maximum number of rooms and a new chat/room assignment is attempted; license tier changed lowering the cap below existing usage; test/staging workspace with a low cap.","solutions":["Remove the guest from an existing room before adding them to a new one.","Raise the roomsPerGuest limit on the license / workspace settings if your plan allows.","Convert the user from 'guest' to a full user role if they need more rooms.","Contact Rocket.Chat sales/support to adjust the license entitlement."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function wouldExceedGuestRoomLimit(userId: string): Promise<boolean> {\n  return License.shouldPreventAction('roomsPerGuest', 1, { userId });\n}","typeGuard":null,"tryCatchPattern":"try {\n  await addGuestToRoom(guestId, roomId);\n} catch (e) {\n  if (e.error === 'error-max-rooms-per-guest-reached') {\n    // notify agent that the guest is at the room cap\n  } else throw e;\n}","preventionTips":["Remove guests from old rooms before assigning new ones.","Surface the configured roomsPerGuest limit in the admin UI.","Review guest role assignments — convert power users to full users.","Track guest room counts to warn before hitting the cap."],"tags":["enterprise","license","omnichannel","guest","limits"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}