{"record":{"id":"e5ffd51d2380ef17","repo":"RocketChat/Rocket.Chat","slug":"room-roomdata-id-is-not-a-livechat-room","errorCode":null,"errorMessage":"Room ${roomData._id} is not a livechat room","messagePattern":"Room (.+?) is not a livechat room","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/app/apps/server/bridges/listeners.ts","lineNumber":517,"sourceCode":"\t\t\t\tconst department = await this.orch.getConverters().get('departments').convertDepartment(departmentData);\n\n\t\t\t\tif (!department) {\n\t\t\t\t\tthrow new Error(`Department ${departmentData._id} not found`);\n\t\t\t\t}\n\n\t\t\t\treturn this.orch.getManager().getListenerManager().executeListener(args.event, { department });\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tconst [roomData] = args.payload;\n\t\t\t\tconst room = await this.orch.getConverters().get('rooms').convertRoom(roomData);\n\n\t\t\t\tif (!room) {\n\t\t\t\t\tthrow new Error(`Room ${roomData._id} not found`);\n\t\t\t\t}\n\n\t\t\t\tif (!isLivechatRoom(room)) {\n\t\t\t\t\tthrow new Error(`Room ${roomData._id} is not a livechat room`);\n\t\t\t\t}\n\n\t\t\t\treturn this.orch.getManager().getListenerManager().executeListener(args.event, room);\n\t\t}\n\t}\n\n\tasync userEvent(args: HandleUserEvent): Promise<unknown> {\n\t\tswitch (args.event) {\n\t\t\tcase AppInterface.IPostUserLoggedIn:\n\t\t\tcase AppInterface.IPostUserLoggedOut: {\n\t\t\t\tconst [loggedInUser] = args.payload;\n\t\t\t\tconst context = this.orch.getConverters().get('users').convertToApp(loggedInUser);\n\t\t\t\treturn this.orch.getManager().getListenerManager().executeListener(args.event, context);\n\t\t\t}\n\t\t\tcase AppInterface.IPostUserStatusChanged: {\n\t\t\t\tconst [statusData] = args.payload;\n\t\t\t\tconst { currentStatus, previousStatus } = statusData;\n\t\t\t\tconst context = {","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/listeners.ts#L499-L535","documentation":"Thrown by the default branch of livechatEvent after convertRoom succeeds but the resulting object fails the isLivechatRoom type guard. The bridge only dispatches livechat events for genuine omnichannel rooms; a room of another type (channel, direct, discussion) reaching this path is rejected. It protects App livechat listeners from receiving non-livechat rooms.","triggerScenarios":"The default branch converts a room successfully, but isLivechatRoom(room) returns false, e.g. a non-omnichannel room (t:'c' | 'd' | 'p') was passed as the payload of a livechat-branded event, or a room's t field is missing/changed.","commonSituations":"A custom integration fires a livechat event with a regular room id; a room was migrated/converted away from livechat type; corrupted room data with a missing or wrong t field; an App that mishandles event routing.","solutions":["Confirm the event payload references an omnichannel room (LivechatRooms, t === 'l').","If the room was changed from livechat to another type, stop dispatching livechat events for it.","Repair corrupted room documents whose t field is missing or invalid.","Audit custom code that emits livechat events to ensure it only does so for livechat rooms."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"import { isLivechatRoom } from '<livechat room guard module>';\n\nconst room = await LivechatRooms.findOneById(roomData._id);\nif (!room || !isLivechatRoom(room)) {\n  // do not dispatch a livechat event for a non-livechat room\n  return;\n}\nawait emitEvent(args.event, { payload: [roomData] });","typeGuard":"const isLivechatRoomByType = (room: { t?: string } | null): room is { t: 'l' } =>\n  room?.t === 'l';","tryCatchPattern":"try {\n  if (!isLivechatRoom(room)) {\n    this.orch.debugLog(`Room ${roomData._id} is not livechat; skipping ${args.event}`);\n    return;\n  }\n  await listenerManager.executeListener(args.event, room);\n} catch (e) {\n  this.orch.debugLog(`Skipping ${args.event}: ${(e as Error).message}`);\n}","preventionTips":["Only emit livechat events for rooms whose t field is 'l'.","Audit custom integrations that route room events to ensure correct typing.","Repair rooms with missing/corrupted t fields."],"tags":["apps-engine","livechat","event-listener","type-guard","data-integrity"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}