{"record":{"id":"beadbe0120c54b6a","repo":"RocketChat/Rocket.Chat","slug":"room-with-id-roomid-not-found","errorCode":null,"errorMessage":"Room with id ${roomId} not found","messagePattern":"Room with id (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/app/apps/server/bridges/listeners.ts","lineNumber":477,"sourceCode":"\t\t\t}\n\n\t\t\tcase AppInterface.IPostLivechatGuestSaved: {\n\t\t\t\tconst [visitorId] = args.payload;\n\t\t\t\tconst visitor = await this.orch.getConverters().get('visitors').convertById(visitorId);\n\n\t\t\t\tif (!visitor) {\n\t\t\t\t\tthrow new Error(`Visitor with id ${visitorId} not found`);\n\t\t\t\t}\n\n\t\t\t\treturn this.orch.getManager().getListenerManager().executeListener(args.event, visitor);\n\t\t\t}\n\n\t\t\tcase AppInterface.IPostLivechatRoomSaved: {\n\t\t\t\tconst [roomId] = args.payload;\n\t\t\t\tconst room = await this.orch.getConverters().get('rooms').convertById(roomId);\n\n\t\t\t\tif (!room) {\n\t\t\t\t\tthrow new Error(`Room with id ${roomId} not found`);\n\t\t\t\t}\n\n\t\t\t\treturn this.orch\n\t\t\t\t\t.getManager()\n\t\t\t\t\t.getListenerManager()\n\t\t\t\t\t.executeListener(args.event, room as IAppsLivechatRoom);\n\t\t\t}\n\n\t\t\tcase AppInterface.IPostLivechatDepartmentDisabled: {\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}","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/listeners.ts#L459-L495","documentation":"Thrown by the livechatEvent handler for IPostLivechatRoomSaved when the rooms converter's convertById returns null for the given roomId. The bridge cannot deliver the room-saved event to App listeners without a materialized room object, so it aborts. It signals the room record is missing at conversion time.","triggerScenarios":"Server emits IPostLivechatRoomSaved with a roomId; convertById resolves falsy because the LivechatRooms document was removed, the rid is malformed, or the room was archived/deleted between the save and the after-save hook execution.","commonSituations":"A room is closed and pruned immediately after being saved; an omni-core purge/retention policy removes the room; a custom flow dispatches IPostLivechatRoomSaved with a stale or fabricated rid; Mongo replication lag.","solutions":["Confirm the room still exists in LivechatRooms when the after-save hook runs (check retention/prune policies and concurrent closeRoom calls).","Ensure any code that manually emits IPostLivechatRoomSaved passes the rid of a committed room.","Review omnichannel data-retention settings that may delete rooms faster than events are drained.","Inspect server logs for the offending rid and query LivechatRooms directly to confirm the document is absent."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const room = await LivechatRooms.findOneById(roomId);\nif (!room) {\n  return; // do not emit IPostLivechatRoomSaved\n}\nawait emitEvent(AppInterface.IPostLivechatRoomSaved, { payload: [roomId] });","typeGuard":"const isPersistedRoomId = async (id: string): Promise<boolean> => {\n  return Boolean(await LivechatRooms.findOneById(id, { projection: { _id: 1 } }));\n};","tryCatchPattern":"try {\n  await listenerManager.executeListener(args.event, room);\n} catch (e) {\n  this.orch.debugLog(`Skipping ${args.event} for room ${roomId}: ${(e as Error).message}`);\n}","preventionTips":["Ensure room retention/prune jobs do not run between save and the after-save hook.","Pass committed room ids when emitting IPostLivechatRoomSaved manually.","Monitor for the offending rid in logs and reconcile missing rooms."],"tags":["apps-engine","livechat","event-listener","data-integrity"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}