{"record":{"id":"1c2145f04ee2f0f5","repo":"RocketChat/Rocket.Chat","slug":"error-mac-limit-reached","errorCode":"error-mac-limit-reached","errorMessage":"error-mac-limit-reached","messagePattern":"error-mac-limit-reached","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/omnichannel/room.ts","lineNumber":304,"sourceCode":"\t{ authRequired: true, permissionsRequired: ['view-l-room', 'transfer-livechat-guest'], validateParams: isLiveChatRoomForwardProps },\n\t{\n\t\tasync post() {\n\t\t\tconst transferData = this.bodyParams as typeof this.bodyParams & {\n\t\t\t\ttransferredBy: TransferByData;\n\t\t\t\ttransferredTo?: { _id: string; username?: string; name?: string };\n\t\t\t};\n\n\t\t\tconst room = await LivechatRooms.findOneById(this.bodyParams.roomId);\n\t\t\tif (room?.t !== 'l') {\n\t\t\t\tthrow new Error('error-invalid-room');\n\t\t\t}\n\n\t\t\tif (!room.open) {\n\t\t\t\tthrow new Error('This_conversation_is_already_closed');\n\t\t\t}\n\n\t\t\tif (!(await Omnichannel.isWithinMACLimit(room))) {\n\t\t\t\tthrow new Error('error-mac-limit-reached');\n\t\t\t}\n\n\t\t\tconst guest = await LivechatVisitors.findOneEnabledById(room.v?._id);\n\t\t\tif (!guest) {\n\t\t\t\tthrow new Error('error-invalid-visitor');\n\t\t\t}\n\n\t\t\ttransferData.transferredBy = normalizeTransferredByData(this.user, room);\n\t\t\tif (transferData.userId) {\n\t\t\t\tconst userToTransfer = await Users.findOneById(transferData.userId);\n\t\t\t\tif (userToTransfer) {\n\t\t\t\t\ttransferData.transferredTo = {\n\t\t\t\t\t\t_id: userToTransfer._id,\n\t\t\t\t\t\tusername: userToTransfer.username,\n\t\t\t\t\t\tname: userToTransfer.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/omnichannel/room.ts#L286-L322","documentation":"Thrown by POST livechat/room.forward when Omnichannel.isWithinMACLimit(room) returns false. MAC (Maximum Active Conversations) caps how many simultaneous open Livechat rooms an agent can serve; the check runs on the destination/transfer context. Forwarding is refused when the receiving agent would exceed their configured MAC.","triggerScenarios":"POST livechat/room.forward where the transfer target (userId/department) already holds >= their MAC limit of open conversations. Also fires if the system-wide Livechat_maximum_chats_per_agent is low and the room count is at the ceiling.","commonSituations":"Transferring to a busy agent during peak load; department-level MAC set lower than expected after an admin policy change; auto-routing queued the agent to capacity before the manual forward; misconfigured Livechat_maximum_chats_per_agent (0 or unset behaving as unlimited vs a numeric cap).","solutions":["Transfer to a different agent or department whose open conversation count is under their MAC limit.","Raise the Livechat_maximum_chats_per_agent setting (Admin > Omnichannel) if the cap is too restrictive.","Queue the transfer instead of forcing it (use department transfer with queueing enabled).","Check current load via livechat/analytics or agents endpoint before offering the transfer target in the UI."],"exampleFix":"// before\nawait POST('/api/v1/livechat/room.forward', { roomId, userId: targetId });\n\n// after\nconst load = await GET('/api/v1/livechat/analytics/agent-overview', { name: 'Chats', departmentId });\nif (load[targetId]?.open >= macLimit) {\n  suggestAlternativeAgent();\n} else {\n  await POST('/api/v1/livechat/room.forward', { roomId, userId: targetId });\n}","handlingStrategy":"validation","validationCode":"const macLimit = settings.get('Livechat_maximum_chats_per_agent');\nconst openCount = await LivechatRooms.countOpenByAgent(targetUserId);\nif (macLimit && openCount >= macLimit) throw new ClientError('target-at-mac');","typeGuard":"null","tryCatchPattern":"try {\n  await POST('/api/v1/livechat/room.forward', { roomId, userId });\n} catch (e) {\n  if (e.message === 'error-mac-limit-reached') { offerAlternativeAgents(); return; }\n  throw e;\n}","preventionTips":["Show agent load (open room count vs MAC) in the transfer picker before selection.","Prefer department-based queueing over direct user transfer during peak hours.","Review the Livechat_maximum_chats_per_agent value whenever team capacity changes."],"tags":["omnichannel","livechat","mac-limit","capacity","transfer"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}