{"record":{"id":"2afa2bd3b5e60618","repo":"RocketChat/Rocket.Chat","slug":"error-room-not-served","errorCode":null,"errorMessage":"error-room-not-served","messagePattern":"error-room-not-served","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/local-services/omnichannel.internalService.ts","lineNumber":101,"sourceCode":"\t\tthis.logger.debug({ msg: 'Attempting to resume room on hold', roomId: room._id, userId: resumeBy?._id });\n\n\t\tif (!room || !isOmnichannelRoom(room)) {\n\t\t\tthrow new Error('error-invalid-room');\n\t\t}\n\n\t\tif (!room.open) {\n\t\t\tthrow new Error('This_conversation_is_already_closed');\n\t\t}\n\n\t\tif (!room.onHold) {\n\t\t\tthrow new Error('error-room-not-on-hold');\n\t\t}\n\n\t\tconst { _id: roomId, servedBy } = room;\n\n\t\tif (!servedBy) {\n\t\t\tthis.logger.error({ msg: 'No serving agent found for room', roomId });\n\t\t\tthrow new Error('error-room-not-served');\n\t\t}\n\n\t\tconst inquiry = await LivechatInquiry.findOneByRoomId(roomId, {});\n\t\tif (!inquiry) {\n\t\t\tthis.logger.error({ msg: 'No inquiry found for room', roomId });\n\t\t\tthrow new Error('error-invalid-inquiry');\n\t\t}\n\n\t\tawait this.attemptToAssignRoomToServingAgentElseQueueIt({\n\t\t\troom,\n\t\t\tinquiry,\n\t\t\tservingAgent: servedBy,\n\t\t\tclientAction,\n\t\t});\n\n\t\tconst [roomResult, subsResult] = await Promise.all([\n\t\t\tLivechatRooms.unsetOnHoldByRoomId(roomId),\n\t\t\tSubscriptions.unsetOnHoldByRoomId(roomId),","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/local-services/omnichannel.internalService.ts#L83-L119","documentation":"Thrown by resumeRoomOnHold (omnichannel.internalService.ts:101) when the on-hold room has no servedBy agent. Resuming means re-assigning the chat to its previous serving agent; if the room lost its agent (returned to queue, agent removed) there is nobody to hand it back to, so the service refuses.","triggerScenarios":"Resuming an on-hold room whose servedBy is unset — the serving agent was removed while the chat was on hold, routing already stripped the agent, or the room is in an inconsistent served-less state.","commonSituations":"Agent went offline/was removed during the hold and a flow cleared servedBy; the conversation was queued again while flagged on hold; data inconsistency after manual DB edits or a partially failed routing operation.","solutions":["Check room.servedBy before calling resumeRoomOnHold and route through the normal queue/assignment flow when it is absent","Investigate why the on-hold room lost its serving agent (agent removal flow, routing manager) — on-hold rooms are expected to keep servedBy","Repair the room record by re-assigning an agent (or clearing onHold) before retrying the resume"],"exampleFix":"// before\nawait omnichannelService.resumeRoomOnHold(room, comment, agent);\n\n// after\nif (!room.servedBy) {\n\t// no previous agent to resume with — fall back to queue routing\n\treturn RoutingManager.takeQueue(sessionId);\n}\nawait omnichannelService.resumeRoomOnHold(room, comment, agent);","handlingStrategy":"validation","validationCode":"const room = await LivechatRooms.findOneById(rid, { projection: { t: 1, open: 1, onHold: 1, servedBy: 1 } });\nif (!room?.servedBy) {\n\t// no previous agent — use queue assignment instead of resume\n\treturn;\n}\nawait omnichannelService.resumeRoomOnHold(room, comment, agent);","typeGuard":"const isServedRoom = (room: IOmnichannelRoom | null | undefined): room is IOmnichannelRoom & { servedBy: NonNullable<IOmnichannelRoom['servedBy']> } =>\n\t!!room && !!room.servedBy;","tryCatchPattern":"try {\n\tawait omnichannelService.resumeRoomOnHold(room, comment, agent);\n} catch (e) {\n\tif (e instanceof Error && e.message === 'error-room-not-served') {\n\t\t// re-assign via queue/routing instead of resume\n\t}\n\tthrow e;\n}","preventionTips":["Guard resume flows with a servedBy check and fall back to queue routing","Keep on-hold rooms' servedBy intact when removing agents, or clear onHold at the same time","Monitor logs for 'No serving agent found for room' to catch inconsistent rooms early"],"tags":["omnichannel","livechat","on-hold","agent-assignment","data-inconsistency"],"backgroundTag":"missing-associated-resource","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"}