{"record":{"id":"813894d88d425fa9","repo":"RocketChat/Rocket.Chat","slug":"error-contact-channel-blocked","errorCode":"error-contact-channel-blocked","errorMessage":"error-contact-channel-blocked","messagePattern":"error-contact-channel-blocked","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/omnichannel/rooms.ts","lineNumber":64,"sourceCode":"\tnotifyOnSubscriptionChanged,\n\tnotifyOnRoomChanged,\n} from '../notifyListener';\n\nexport async function getRoom(\n\tguest: ILivechatVisitor,\n\tmessage: Pick<IMessage, 'rid' | 'msg' | 'token'>,\n\troomInfo: IOmnichannelRoomInfo,\n\tagent?: SelectedAgent,\n\textraData?: IOmnichannelRoomExtraData,\n) {\n\tif (!settings.get('Livechat_enabled')) {\n\t\tthrow new Meteor.Error('error-omnichannel-is-disabled');\n\t}\n\tlivechatLogger.debug({ msg: 'Attempting to find or create a room for visitor', visitorId: guest._id });\n\tconst room = await LivechatRooms.findOneById(message.rid);\n\n\tif (room?.v._id && (await LivechatContacts.isChannelBlocked(Visitors.makeVisitorAssociation(room.v._id, room.source)))) {\n\t\tthrow new Error('error-contact-channel-blocked');\n\t}\n\n\tif (!room?.open) {\n\t\tlivechatLogger.debug({ msg: 'Last room for visitor closed. Creating new one', visitorId: guest._id });\n\t}\n\n\tif (!room?.open) {\n\t\treturn {\n\t\t\troom: await createRoom({ visitor: guest, message: message.msg, roomInfo, agent, extraData }),\n\t\t\tnewRoom: true,\n\t\t};\n\t}\n\n\tif (room.v.token !== guest.token) {\n\t\tlivechatLogger.debug({ msg: 'Visitor trying to access another visitor room', visitorId: guest._id });\n\t\tthrow new Meteor.Error('cannot-access-room');\n\t}\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/omnichannel/rooms.ts#L46-L82","documentation":"After getRoom locates the room, it asks LivechatContacts.isChannelBlocked for the visitor association (room.v._id + room.source). If the contact's channel is blocked, a plain Error('error-contact-channel-blocked') is thrown, so the visitor cannot continue the existing conversation.","triggerScenarios":"A visitor whose contact channel (e.g., a WhatsApp number or other source identity) was blocked sends a message into an existing room: the room lookup succeeds, then the block check fails.","commonSituations":"An agent or automation blocked the contact in the omnichannel Contacts panel; a spam contact keeps reusing an old rid; a moderation workflow blocks channels automatically.","solutions":["Unblock the contact channel in Administration > Omnichannel > Contacts (or the equivalent contact API) and retry.","If the block was automated, review the rule/app that blocked this visitor.","Inspect the LivechatContacts record for the visitor/source pair to confirm the block state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const blocked = room?.v?._id\n\t? await LivechatContacts.isChannelBlocked(Visitors.makeVisitorAssociation(room.v._id, room.source))\n\t: false;\nif (blocked) {\n\t// inform the visitor the channel is blocked instead of calling getRoom\n}","typeGuard":null,"tryCatchPattern":"try {\n\tconst { room } = await getRoom(guest, message, roomInfo);\n} catch (err) {\n\tif ((err as Error).message === 'error-contact-channel-blocked') {\n\t\t// show 'this channel can no longer be used'; do not retry\n\t\treturn;\n\t}\n\tthrow err;\n}","preventionTips":["Check the contact's block state before routing new messages into an existing room.","Surface blocklist changes to agents so they understand why visitors go quiet.","Automated blocking rules should log which visitor/source they blocked and why."],"tags":["omnichannel","livechat","contacts","blocklist","room-creation"],"backgroundTag":"contact-blocked","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}