{"record":{"id":"4f3f4962dfe330fa","repo":"RocketChat/Rocket.Chat","slug":"error-room-param-not-provided","errorCode":"error-room-param-not-provided","errorMessage":"The parameter \"roomId\" or \"roomName\" is required","messagePattern":"The parameter \"roomId\" or \"roomName\" is required","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/groups.ts","lineNumber":73,"sourceCode":"import { leaveRoomMethod } from '../../meteor-methods/rooms/leaveRoom';\nimport { removeRoomLeader } from '../../meteor-methods/rooms/removeRoomLeader';\nimport { removeRoomModerator } from '../../meteor-methods/rooms/removeRoomModerator';\nimport { removeRoomOwner } from '../../meteor-methods/rooms/removeRoomOwner';\nimport { removeUserFromRoomMethod } from '../../meteor-methods/rooms/removeUserFromRoom';\nimport { saveRoomSettings } from '../../meteor-methods/rooms/saveRoomSettings';\nimport { executeUnarchiveRoom } from '../../meteor-methods/rooms/unarchiveRoom';\nimport { API } from '../api';\nimport { addUserToFileObj } from '../lib/addUserToFileObj';\nimport { composeRoomWithLastMessage } from '../lib/composeRoomWithLastMessage';\nimport { getPaginationItems } from '../lib/getPaginationItems';\nimport { getUserFromParams, getUserListFromParams, getUsernameListFromParams } from '../lib/getUserFromParams';\n\nasync function getRoomFromParams(params: { roomId?: string } | { roomName?: string }): Promise<IRoom> {\n\tif (\n\t\t(!('roomId' in params) && !('roomName' in params)) ||\n\t\t('roomId' in params && !(params as { roomId?: string }).roomId && 'roomName' in params && !(params as { roomName?: string }).roomName)\n\t) {\n\t\tthrow new Meteor.Error('error-room-param-not-provided', 'The parameter \"roomId\" or \"roomName\" is required');\n\t}\n\n\tconst roomOptions = {\n\t\tprojection: {\n\t\t\t...roomAccessAttributes,\n\t\t\tt: 1,\n\t\t\tro: 1,\n\t\t\tname: 1,\n\t\t\tfname: 1,\n\t\t\tprid: 1,\n\t\t\tarchived: 1,\n\t\t\tbroadcast: 1,\n\t\t},\n\t};\n\n\tconst room = await (() => {\n\t\tif ('roomId' in params) {\n\t\t\treturn Rooms.findOneById(params.roomId || '', roomOptions);","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/groups.ts#L55-L91","documentation":"Thrown by getRoomFromParams, the helper behind the groups.* endpoints, when neither 'roomId' nor 'roomName' is supplied, or both are present but empty strings. At least one non-empty identifier is required to locate the private group.","triggerScenarios":"Calling groups.info / groups.members / etc. with no roomId and no roomName; both passed as empty strings; client submits the form without selecting a room.","commonSituations":"UI form submitted before a room was chosen; URL builder ran with undefined for both; query-string parsing dropped both params.","solutions":["Pass exactly one of roomId or roomName as a non-empty string.","Validate client-side that at least one identifier is present before the call.","If both are known, prefer roomId (direct lookup) over roomName."],"exampleFix":"// before\nconst url = `/api/v1/groups.info?roomId=${rid ?? ''}&roomName=${rname ?? ''}`;\n// after\nconst id = rid ?? rname;\nif (!id) throw new Error('roomId or roomName required');\nconst url = rid ? `/api/v1/groups.info?roomId=${encodeURIComponent(rid)}` : `/api/v1/groups.info?roomName=${encodeURIComponent(rname)}`;","handlingStrategy":"validation","validationCode":"function requireRoomIdOrName(params) {\n  const id = ('roomId' in params && params.roomId) || ('roomName' in params && params.roomName);\n  if (!id) throw new Error('roomId or roomName required');\n  return id;\n}","typeGuard":"function hasRoomIdentifier(p): p is { roomId?: string; roomName?: string } {\n  return (!!p && typeof p === 'object') && (!!p.roomId || !!p.roomName);\n}","tryCatchPattern":"try { await groupsInfo({ roomId }); }\ncatch (e) {\n  if (isApiError(e, 'error-room-param-not-provided')) { /* require a selection */) }\n  else throw e;\n}","preventionTips":["Validate that at least one of roomId/roomName is non-empty before calling.","Prefer roomId for direct lookups.","Bind group actions to a selected room in the UI."],"tags":["groups","validation","rest-api","rooms"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}