{"record":{"id":"e5db9c0fb6a86f17","repo":"RocketChat/Rocket.Chat","slug":"error-license-user-limit-reached-e5db9c","errorCode":"error-license-user-limit-reached","errorMessage":"error-license-user-limit-reached","messagePattern":"error-license-user-limit-reached","errorType":"exception","errorClass":"MeteorError","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/lib/authorization/validateUserRoles.ts","lineNumber":50,"sourceCode":"\tif (isGuest) {\n\t\treturn;\n\t}\n\n\tconst isActive = Boolean(userData.active !== false);\n\tconst wasActive = currentUserData && currentUserData?.active !== false;\n\n\tconst hasRemovedSpecialType = (wasApp && !isApp) || (wasBot && !isBot);\n\n\tif (!isActive) {\n\t\treturn;\n\t}\n\n\tif (!hasRemovedSpecialType && wasActive) {\n\t\treturn;\n\t}\n\n\tif (await License.shouldPreventAction('activeUsers')) {\n\t\tthrow new MeteorError('error-license-user-limit-reached', i18n.t('error-license-user-limit-reached'));\n\t}\n}\n","sourceCodeStart":32,"sourceCodeEnd":53,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/lib/authorization/validateUserRoles.ts#L32-L53","documentation":"Thrown by validateUserRoles when activating (or newly creating) a non-special-type user beyond the license's activeUsers cap. The check fires only when the user is active AND either they were previously inactive, or a special type (app/bot) was removed. MeteorError code 'error-license-user-limit-reached' (message i18n-translated).","triggerScenarios":"Activating a previously inactive user, removing an app/bot type from a user (so they now count as a regular active user), or creating a new active user when the active-user seat count is already at the license limit.","commonSituations":"License was downgraded (fewer seats) while the user base stayed the same and now an admin tries to activate another user; bulk re-activation of disabled accounts; license trial expired.","solutions":["Deactivate another active user to free a seat, then retry the activation.","Upgrade the license to raise the activeUsers cap.","Leave the user inactive, or mark them as app/bot if appropriate (special types are exempt).","Audit the active user count vs. licensed seats before provisioning new users."],"exampleFix":"// before: activate past the cap\nawait Users.updateOne({ _id }, { $set: { active: true } });\nawait validateUserRoles({ active: true }, { active: false });\n\n// after: check headroom\nif (await License.shouldPreventAction('activeUsers')) {\n  throw new Error('No active seats available — deactivate a user or upgrade');\n}","handlingStrategy":"validation","validationCode":"async function canActivateUser(): Promise<boolean> {\n  return !(await License.shouldPreventAction('activeUsers'));\n}","typeGuard":"const willActivate = (next: Partial<IUser>, prev?: Partial<IUser>): boolean =>\n  next.active !== false && !(prev && prev.active !== false);","tryCatchPattern":"try { await validateUserRoles({ active: true }, { active: false }); } catch (e) {\n  if (e?.error === 'error-license-user-limit-reached') { /* deactivate another user or upgrade */ } else throw e;\n}","preventionTips":["Monitor active-user count vs. licensed seats.","Prefer deactivating inactive users before provisioning new ones.","Use app/bot special types where appropriate — they are exempt."],"tags":["license","users","seats","enterprise"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}