{"record":{"id":"fdcfd234ea5d48e1","repo":"RocketChat/Rocket.Chat","slug":"error-mac-limit-reached-fdcfd2","errorCode":"error-mac-limit-reached","errorMessage":"error-mac-limit-reached","messagePattern":"error-mac-limit-reached","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/omnichannel/takeInquiry.ts","lineNumber":48,"sourceCode":"\t\tuserId,\n\t\tsettings.get<boolean>('Livechat_enabled_when_agent_idle'),\n\t\tsettings.get<boolean>('Livechat_accept_chats_with_no_agents'),\n\t\t{},\n\t);\n\tif (!user) {\n\t\tthrow new Meteor.Error('error-agent-status-service-offline', 'Agent status is offline or Omnichannel service is not active', {\n\t\t\tmethod: 'livechat:takeInquiry',\n\t\t\t...(process.env.TEST_MODE && {\n\t\t\t\tLivechat_enabled_when_agent_idle: settings.get<boolean>('Livechat_enabled_when_agent_idle'),\n\t\t\t\tLivechat_accept_chats_with_no_agents: settings.get<boolean>('Livechat_accept_chats_with_no_agents'),\n\t\t\t\tuser: await Users.findOneById(userId),\n\t\t\t}),\n\t\t});\n\t}\n\n\tconst room = await LivechatRooms.findOneById(inquiry.rid);\n\tif (!room || !(await Omnichannel.isWithinMACLimit(room))) {\n\t\tthrow new Meteor.Error('error-mac-limit-reached');\n\t}\n\n\tconst contactId = room.contactId ?? (await migrateVisitorIfMissingContact(room.v._id, room.source));\n\tif (contactId) {\n\t\tconst isAgentAvailableToTakeContactInquiryResult = await isAgentAvailableToTakeContactInquiry(inquiry.v._id, room.source, contactId);\n\t\tif (!isAgentAvailableToTakeContactInquiryResult.value) {\n\t\t\tthrow new Meteor.Error(isAgentAvailableToTakeContactInquiryResult.error);\n\t\t}\n\t}\n\n\tconst agent = {\n\t\tagentId: user._id,\n\t\tusername: user.username,\n\t};\n\n\tawait RoutingManager.takeInquiry(inquiry, agent, options ?? {}, room);\n};\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/omnichannel/takeInquiry.ts#L30-L66","documentation":"In takeInquiry, after the agent check, the code loads the room and throws Meteor.Error('error-mac-limit-reached') when the room is missing OR Omnichannel.isWithinMACLimit(room) fails — note the compound condition: a deleted room also surfaces under this code. The MAC (Monthly Active Contacts) check enforces the workspace's enterprise omnichannel license allowance.","triggerScenarios":"Taking an inquiry whose room no longer exists (deleted concurrently), or taking an inquiry for a contact that would exceed the workspace's monthly active contacts limit under the current license.","commonSituations":"License MAC cap reached mid-month (traffic spike, campaigns), expired trial with reduced allowance, or rooms removed by retention/cleanup while their inquiry was still queued — the latter masquerades as a licensing error because of the compound check.","solutions":["First rule out the non-license cause: confirm the room exists (db.rocketchat_room.findOne({_id: inquiry.rid}))","Check current MAC usage in Administration > Omnichannel and compare against the license allowance","Increase the allowance (license upgrade) or wait for the monthly reset","Clean up orphaned inquiries whose rooms were deleted so agents don't hit the confusing error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { LivechatRooms } from '@rocket.chat/models';\n\n// rule out the non-license cause first: the room may simply be gone\nconst room = await LivechatRooms.findOneById(inquiry.rid);\nif (!room) {\n  return discardOrphanedInquiry(inquiry._id);\n}\nawait Meteor.callAsync('livechat:takeInquiry', inquiryId);","typeGuard":null,"tryCatchPattern":"try {\n  await Meteor.callAsync('livechat:takeInquiry', inquiryId);\n} catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-mac-limit-reached') {\n    // check room existence AND MAC usage — the code covers both causes\n  } else {\n    throw err;\n  }\n}","preventionTips":["Purge inquiries whose rooms were deleted so agents never see this misleading code","Monitor MAC usage vs license cap; alert admins before the limit","When triaging, always verify the room exists before assuming a licensing problem"],"tags":["omnichannel","mac-limit","license","take-inquiry","room-not-found"],"backgroundTag":"license-limit-reached","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"}