{"record":{"id":"4b145f58ea8420f3","repo":"RocketChat/Rocket.Chat","slug":"room-roomdata-id-not-found","errorCode":null,"errorMessage":"Room ${roomData._id} not found","messagePattern":"Room (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/app/apps/server/bridges/listeners.ts","lineNumber":513,"sourceCode":"\t\t\t}\n\n\t\t\tcase AppInterface.IPostLivechatDepartmentRemoved: {\n\t\t\t\tconst [departmentData] = args.payload;\n\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}","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/listeners.ts#L495-L531","documentation":"Thrown by the default branch of the livechatEvent switch for any livechat room event not matched by an explicit case. It calls convertRoom(roomData) and, if that returns null, reports the room as not found. This catches newer or unhandled livechat events whose payload is a room object.","triggerScenarios":"A livechat event reaches the default branch (no dedicated case), args.payload[0] is roomData, and convertRoom resolves falsy because the room was deleted, the payload is malformed, or roomData._id does not correspond to a persisted LivechatRooms document.","commonSituations":"A new livechat AppInterface event is emitted by core but no case was added to the bridge; a room is purged between the event firing and processing; a custom integration dispatches an undocumented livechat event with a synthetic/partial room payload.","solutions":["Identify which event landed in the default branch (log args.event) and confirm whether the bridge needs a dedicated case for it.","Verify roomData._id maps to an existing LivechatRooms document at processing time.","Ensure custom event dispatch passes a room snapshot that convertRoom can resolve.","Upgrade the apps-engine bridge together with core so new events have explicit handlers."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const room = await LivechatRooms.findOneById(roomData._id);\nif (!room) {\n  // do not dispatch a livechat event for a missing room\n  return;\n}\nawait emitEvent(args.event, { payload: [roomData] });","typeGuard":"const isPersistedRoom = async (data: { _id: string }): Promise<boolean> =>\n  Boolean(await LivechatRooms.findOneById(data._id, { projection: { _id: 1 } }));","tryCatchPattern":"try {\n  await listenerManager.executeListener(args.event, room);\n} catch (e) {\n  this.orch.debugLog(`Skipping ${args.event} for room ${roomData._id}: ${(e as Error).message}`);\n}","preventionTips":["Log args.event to identify which event hits the default branch and add a dedicated case if needed.","Only dispatch livechat room events for rooms that still exist.","Keep the bridge and core in lockstep so new events have explicit handlers."],"tags":["apps-engine","livechat","event-listener","default-case","data-integrity"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}