{"record":{"id":"fabe6aa447a61785","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-room-fabe6a","errorCode":"error-invalid-room","errorMessage":"Invalid room","messagePattern":"Invalid room","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/publications/room/index.ts","lineNumber":55,"sourceCode":"\n\tif (updatedAt instanceof Date) {\n\t\treturn {\n\t\t\tupdate: await (await Rooms.findBySubscriptionUserIdUpdatedAfter(userId, updatedAt, options)).toArray(),\n\t\t\tremove: await Rooms.trashFindDeletedAfter(updatedAt, {}, { projection: { _id: 1, _deletedAt: 1 } }).toArray(),\n\t\t};\n\t}\n\n\treturn (await Rooms.findBySubscriptionUserId(userId, options)).toArray();\n};\n\nMeteor.methods<ServerMethods>({\n\tasync 'rooms/get'(updatedAt) {\n\t\treturn roomsGetMethod(Meteor.userId(), updatedAt);\n\t},\n\n\tasync 'getRoomByTypeAndName'(type, name) {\n\t\tif (!type || !name) {\n\t\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\t\tmethod: 'getRoomByTypeAndName',\n\t\t\t});\n\t\t}\n\n\t\tconst user = await Meteor.userAsync();\n\t\tconst isAnonymous = !user?._id;\n\n\t\tif (isAnonymous) {\n\t\t\tconst allowAnon = settings.get('Accounts_AllowAnonymousRead');\n\t\t\tif (!allowAnon || type !== 'c') {\n\t\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\t\t\tmethod: 'getRoomByTypeAndName',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst roomFind = roomCoordinator.getRoomFind(type);\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/publications/room/index.ts#L37-L73","documentation":"Thrown by the 'getRoomByTypeAndName' Meteor method when either the room type or the room name argument is falsy. Both are required to locate a room (type selects the room-type-specific finder, name is the lookup key). The error is reported as 'error-invalid-room' with method 'getRoomByTypeAndName'.","triggerScenarios":"Meteor.call('getRoomByTypeAndName', undefined, 'general'); calling with type '' or name '' ; building the call from optional route params that were never filled.","commonSituations":"Deep links like /channel/ handled before parsing; lookups where the type letter (c/p/d/l) is missing; refactors that swap argument order and pass undefined.","solutions":["Pass both arguments: type must be a room-type string like 'c', 'p', 'd' or 'l', name the room identifier","Validate the inputs at the call site before invoking the method","Parse room type and name from the route before calling"],"exampleFix":"// before\nMeteor.call('getRoomByTypeAndName', roomType, name ?? '');\n\n// after\nif (!roomType || !name) return;\nMeteor.call('getRoomByTypeAndName', roomType, name);","handlingStrategy":"validation","validationCode":"if (!type || !name) {\n  throw new Error('type and name are required');\n}\nMeteor.call('getRoomByTypeAndName', type, name);","typeGuard":"const ROOM_TYPES = new Set(['c', 'p', 'd', 'l', 't']);\nfunction isRoomType(v: unknown): v is 'c' | 'p' | 'd' | 'l' | 't' {\n  return typeof v === 'string' && ROOM_TYPES.has(v);\n}","tryCatchPattern":null,"preventionTips":["Parse both values from the route and skip the call when either is absent","Keep argument order (type, name) consistent across wrappers"],"tags":["meteor","rooms","validation","rocket-chat"],"backgroundTag":"missing-required-parameter","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}