{"record":{"id":"8f3b570a950fd888","repo":"RocketChat/Rocket.Chat","slug":"invalid-room-8f3b57","errorCode":"invalid-room","errorMessage":"invalid-room","messagePattern":"invalid-room","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/omnichannel/transfer.ts","lineNumber":16,"sourceCode":"import { LivechatRooms } from '@rocket.chat/models';\n\nimport { API } from '../..';\nimport { findLivechatTransferHistory } from './lib/transfer';\nimport { getPaginationItems } from '../../lib/getPaginationItems';\n\nAPI.v1.addRoute(\n\t'livechat/transfer.history/:rid',\n\t{ authRequired: true, permissionsRequired: ['view-livechat-rooms'] },\n\t{\n\t\tasync get() {\n\t\t\tconst { rid } = this.urlParams;\n\n\t\t\tconst room = await LivechatRooms.findOneById(rid, { projection: { _id: 1 } });\n\t\t\tif (!room) {\n\t\t\t\tthrow new Error('invalid-room');\n\t\t\t}\n\t\t\tconst { offset, count } = await getPaginationItems(this.queryParams);\n\t\t\tconst { sort } = await this.parseJsonQuery();\n\n\t\t\tconst history = await findLivechatTransferHistory({\n\t\t\t\trid,\n\t\t\t\tpagination: {\n\t\t\t\t\toffset,\n\t\t\t\t\tcount,\n\t\t\t\t\tsort,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn API.v1.success(history);\n\t\t},\n\t},\n);\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/omnichannel/transfer.ts#L1-L34","documentation":"Thrown by GET livechat/transfer.history/:rid when LivechatRooms.findOneById(rid) returns null. The route only projects {_id:1} to confirm existence; it does not validate that the room is an omnichannel room, only that some room with that id exists.","triggerScenarios":"Caller passes a rid that does not exist in the rocketchat_room collection; a mistyped or truncated id; the room was deleted before the call; the id is a valid object id but for a different collection's document.","commonSituations":"Frontend cached a stale rid after the room was closed and pruned; URL parameter substitution bug dropping characters; copy/paste of a message id rather than a room id.","solutions":["Confirm the rid exists via a direct db lookup or the rooms REST endpoint before fetching history.","Re-fetch the current rid from the livechat room list rather than a cached value.","Validate the rid format (17-char alphanum in default deployments) before issuing the request."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"const exists = await fetch('/api/v1/v1/rooms.info?roomName=' + encodeURIComponent(name));\nif (!exists.ok) throw new Error('refresh rid list');\nconst rid = (await exists.json()).room._id;","typeGuard":"null","tryCatchPattern":"try {\n  await fetch(`/api/v1/v1/livechat/transfer.history/${rid}`);\n} catch (e) {\n  if (e.error === 'invalid-room') { /* re-fetch rid from livechat rooms, then retry once */ }\n}","preventionTips":["Always resolve rid from a fresh rooms listing rather than a cached value.","Validate rid format before the request.","Treat invalid-room as a cache-invalidation signal."],"tags":["omnichannel","room","transfer-history","not-found"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}