{"record":{"id":"9e526c1b649855df","repo":"RocketChat/Rocket.Chat","slug":"error-license-user-limit-reached","errorCode":"error-license-user-limit-reached","errorMessage":"error-license-user-limit-reached","messagePattern":"error-license-user-limit-reached","errorType":"error_code","errorClass":"MeteorError","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/hooks/auth/callback.ts","lineNumber":50,"sourceCode":"\t\tcallbacks.priority.HIGH,\n\t\t'validateUserRoles',\n\t);\n\n\tcallbacks.add(\n\t\t'afterDeactivateUser',\n\t\tasync (user) => {\n\t\t\tawait License.shouldPreventAction('activeUsers');\n\t\t\treturn user;\n\t\t},\n\t\tcallbacks.priority.HIGH,\n\t\t'validateUserStatus',\n\t);\n\n\tcallbacks.add(\n\t\t'beforeActivateUser',\n\t\tasync () => {\n\t\t\tif (await License.shouldPreventAction('activeUsers')) {\n\t\t\t\tthrow new MeteorError('error-license-user-limit-reached', i18n.t('error-license-user-limit-reached'));\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\tcallbacks.priority.HIGH,\n\t\t'validateUserStatus',\n\t);\n});\n\nLicense.onInvalidate(() => {\n\tcallbacks.remove('beforeSaveUser', 'validateUserRoles');\n\tcallbacks.remove('afterSaveUser', 'validateUserRoles');\n\tcallbacks.remove('afterDeleteUser', 'validateUserRoles');\n\n\tcallbacks.remove('afterDeactivateUser', 'validateUserStatus');\n\tcallbacks.remove('beforeActivateUser', 'validateUserStatus');\n});\n","sourceCodeStart":32,"sourceCodeEnd":67,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/hooks/auth/callback.ts#L32-L67","documentation":"Thrown by the `beforeActivateUser` callback when `License.shouldPreventAction('activeUsers')` resolves truthy, meaning activating another user would exceed the licensed active-user cap. It uses a `MeteorError` with code `error-license-user-limit-reached` and a localized message via `i18n.t`. The hook runs at HIGH priority under the name `validateUserStatus`.","triggerScenarios":"Activating a user (e.g. admin activates a disabled user, or a user self-activates) when the active user count is already at or above the license limit, so `License.shouldPreventAction('activeUsers')` returns true.","commonSituations":"License tier limit reached (e.g. 500 active users on a 500-seat license); license downgraded to a smaller seat count while more users are already active; bulk user import/activation hitting the cap.","solutions":["Reduce the active user count: deactivate users no longer needed before activating new ones.","Upgrade the license to a higher active-user tier.","Audit which users are active (`Users.find({ active: true })`) and reconcile against the licensed seat count."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { License } from '../../license/license';\n\nasync function canActivateUser(): Promise<boolean> {\n\treturn !(await License.shouldPreventAction('activeUsers'));\n}","typeGuard":"function isLicenseUserLimitError(e: unknown): boolean {\n\treturn e instanceof Meteor.Error && (e as Meteor.Error).error === 'error-license-user-limit-reached';\n}","tryCatchPattern":"try {\n\tawait activateUser(user);\n} catch (e) {\n\tif (e instanceof Meteor.Error && e.error === 'error-license-user-limit-reached') {\n\t\t// deactivate another user or upgrade license\n\t}\n\tthrow e;\n}","preventionTips":["Check `License.shouldPreventAction('activeUsers')` before bulk activations.","Track active-user count against the licensed seat cap.","Upgrade the license tier before hitting the limit."],"tags":["license","users","ee","meteor-error"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}