{"record":{"id":"6241d6dd32613bd4","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-room-6241d6","errorCode":"error-invalid-room","errorMessage":"Invalid room","messagePattern":"Invalid room","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts","lineNumber":30,"sourceCode":"declare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tgetUsersOfRoom(\n\t\t\trid: IRoom['_id'],\n\t\t\tshowAll?: boolean,\n\t\t\toptions?: { limit?: number; skip?: number },\n\t\t\tfilter?: string,\n\t\t): {\n\t\t\ttotal: number;\n\t\t\trecords: IUser[];\n\t\t};\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\tasync getUsersOfRoom(rid, showAll, { limit, skip } = {}, filter) {\n\t\tif (!rid) {\n\t\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'getUsersOfRoom' });\n\t\t}\n\n\t\tcheck(rid, String);\n\n\t\tconst userId = Meteor.userId();\n\t\tif (!userId) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getUsersOfRoom' });\n\t\t}\n\n\t\tconst room = await Rooms.findOneById(rid, { projection: { ...roomAccessAttributes, broadcast: 1 } });\n\t\tif (!room) {\n\t\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'getUsersOfRoom' });\n\t\t}\n\n\t\tif (!(await canAccessRoomAsync(room, { _id: userId }))) {\n\t\t\tthrow new Meteor.Error('not-authorized', 'Not Authorized', { method: 'getUsersOfRoom' });\n\t\t}\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts#L12-L48","documentation":"getUsersOfRoom throws error-invalid-room when its first argument rid is falsy (undefined, null, empty string). This check runs before check(rid, String), so a truthy non-string value would instead fail the Match check — this error specifically means 'no room id was supplied'.","triggerScenarios":"Meteor.callAsync('getUsersOfRoom', rid, ...) with rid undefined or empty — typically a route param, prop, or room record that is not loaded yet when the call fires.","commonSituations":"Member-list component mounting before the room subscription delivered the room; deleted/renamed route param; destructuring typo ({ id } instead of { rid }).","solutions":["Gate the call: only invoke once rid is a non-empty string (room record loaded)","Fix the source of rid — subscribe to the room or read it from the room document you already rendered","Check destructuring/props for the rid field name"],"exampleFix":"// before\nMeteor.callAsync('getUsersOfRoom', rid, showAll, { limit, skip }, filter);\n\n// after\nif (typeof rid !== 'string' || rid.length === 0) return;\nawait Meteor.callAsync('getUsersOfRoom', rid, showAll, { limit, skip }, filter);","handlingStrategy":"validation","validationCode":"if (typeof rid !== 'string' || rid.length === 0) {\n\treturn { total: 0, records: [] }; // room not loaded yet\n}\nawait Meteor.callAsync('getUsersOfRoom', rid, showAll, { limit, skip }, filter);","typeGuard":"const isRoomId = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try {\n\tawait Meteor.callAsync('getUsersOfRoom', rid, showAll, options, filter);\n} catch (err) {\n\tif ((err as { error?: string }).error === 'error-invalid-room') {\n\t\t// rid was empty/undefined — fix the data source, don't retry\n\t}\n}","preventionTips":["Derive rid from a loaded room document, never from raw route params","Gate member-list components on the room subscription being ready","Double-check destructuring ({ rid } vs { id }) at call sites"],"tags":["meteor","ddp","rooms","validation","members"],"backgroundTag":"invalid-room-id","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}