{"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/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/hooks/auth/callback.ts#L32-L67","documentation":"Thrown by the 'beforeActivateUser' callback when the enterprise license's active-user allowance is exhausted (License.shouldPreventAction('activeUsers') resolves true). Rocket.Chat EE counts every active (non-deactivated) user against the license's maxActiveUsers limit, and activating one more user would exceed it. The same guard also fires from validateUserRoles when a user transitions to active. It is a hard business-limit stop, not a bug.","triggerScenarios":"An admin activates a deactivated user, saves a user with active !== false for the first time, or a new user registers/SSO-logs-in while activeUsers count >= the licensed max. Also triggered by insertOrUpdateUser flows (admin UI, REST API user creation, LDAP sync setting users active).","commonSituations":"Expired or trial license after the org grew; imported a large user base during migration; LDAP provisioning activating dormant accounts; license renewed with fewer seats than current active users.","solutions":["Deactivate inactive users until the active count is below the licensed limit, then retry the activation","Check the license status and limit in Administration > License (or GET /api/v1/license.get) and apply a license with a higher maxActiveUsers","If the license was recently renewed but the error persists, restart the server / verify the license payload was applied so the in-memory limits refresh","For migrations, deactivate users before import and activate them in batches under the limit"],"exampleFix":"// before: activating while at the limit throws error-license-user-limit-reached\nawait Meteor.callAsync('insertOrUpdateUser', { ...userData, active: true });\n\n// after: pre-check the license gate the same way the hook does\nimport { License } from '@rocket.chat/license';\nif (await License.shouldPreventAction('activeUsers')) {\n  // stay under the limit first: deactivate another user or upgrade the license\n  throw new Error('Cannot activate: active-user limit reached');\n}\nawait Meteor.callAsync('insertOrUpdateUser', { ...userData, active: true });","handlingStrategy":"validation","validationCode":"import { License } from '@rocket.chat/license';\n\nconst canActivate = async (): Promise<boolean> => !(await License.shouldPreventAction('activeUsers'));","typeGuard":null,"tryCatchPattern":"try {\n  await Meteor.callAsync('insertOrUpdateUser', user);\n} catch (err: any) {\n  if (err?.error === 'error-license-user-limit-reached' || err?.message === 'error-license-user-limit-reached') {\n    // reduce active users or upgrade license, then surface a billing prompt\n  }\n  throw err;\n}","preventionTips":["Monitor active-user count versus the licensed max in admin dashboards before bulk imports","Deactivate dormant accounts before large SSO/LDAP provisioning runs","Keep license renewals ahead of headcount growth"],"tags":["license","enterprise","user-management","billing-limit"],"backgroundTag":"license-limit-exceeded","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}