{"record":{"id":"6da07533c96acd09","repo":"RocketChat/Rocket.Chat","slug":"error-roomid-param-not-provided-6da075","errorCode":"error-roomid-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":400,"severity":"error","filePath":"apps/meteor/server/api/v1/rooms.ts","lineNumber":118,"sourceCode":"\nexport async function findRoomByIdOrName({\n\tparams,\n\tcheckedArchived = true,\n}: {\n\tparams:\n\t\t| {\n\t\t\t\troomId?: string;\n\t\t  }\n\t\t| {\n\t\t\t\troomName?: string;\n\t\t  };\n\tcheckedArchived?: boolean;\n}): 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-roomid-param-not-provided', 'The parameter \"roomId\" or \"roomName\" is required');\n\t}\n\n\tconst projection = { ...API.v1.defaultFieldsToExclude };\n\n\tlet room;\n\tif ('roomId' in params) {\n\t\troom = await Rooms.findOneById(params.roomId || '', { projection });\n\t} else if ('roomName' in params) {\n\t\troom = await Rooms.findOneByName(params.roomName || '', { projection });\n\t}\n\n\tif (!room) {\n\t\tthrow new Meteor.Error('error-room-not-found', 'The required \"roomId\" or \"roomName\" param provided does not match any channel');\n\t}\n\tif (checkedArchived && room.archived) {\n\t\tthrow new Meteor.Error('error-room-archived', `The channel, ${room.name}, is archived`);\n\t}\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/api/v1/rooms.ts#L100-L136","documentation":"Thrown by the shared findRoomByIdOrName helper (used by rooms.info and sibling endpoints) when the request provides neither roomId nor roomName, or provides both keys with both values empty/falsy. Exactly one non-empty identifier is required; this check runs before any database lookup, so it is purely a request-shape error.","triggerScenarios":"GET /api/v1/rooms.info with an empty query string; sending a parameter named rid or channelId instead of roomId/roomName; sending { roomId: '', roomName: '' } where the second clause of the condition (both keys present, both falsy) trips.","commonSituations":"Client code reading the id from an undefined variable and interpolating it into the query; parameter renamed during API migrations; copy-pasted curl commands with the value deleted; form submissions where both optional fields were left blank.","solutions":["Pass exactly one non-empty identifier: ?roomId=<_id> or ?roomName=<name>","Guard the query builder so the request is never sent with both identifiers empty","Check the parameter spelling against the endpoint schema (roomId, not rid or channelId)","Log the outgoing query string when debugging to spot empty values"],"exampleFix":"// before\nawait sdk.get('rooms.info', {}); // no identifier at all\n\n// after\nif (!roomId && !roomName) throw new Error('roomId or roomName is required');\nawait sdk.get('rooms.info', roomId ? { roomId } : { roomName });","handlingStrategy":"type-guard","validationCode":"const hasTarget = (p: { roomId?: string; roomName?: string }) => Boolean(p.roomId?.trim() || p.roomName?.trim());\nif (!hasTarget(query)) throw new Error('roomId or roomName is required');","typeGuard":"type RoomTarget = { roomId: string } | { roomName: string };\nfunction isRoomTarget(p: { roomId?: string; roomName?: string }): p is RoomTarget {\n  return Boolean(p.roomId?.trim() || p.roomName?.trim());\n}","tryCatchPattern":"try {\n  await sdk.get('rooms.info', query);\n} catch (e: any) {\n  if (e?.response?.data?.errorType === 'error-roomid-param-not-provided') {\n    throw new Error('caller bug: no roomId/roomName attached');\n  }\n  throw e;\n}","preventionTips":["Type the request builder so exactly one of roomId/roomName is required","Assert non-empty identifiers at the API-client boundary","Log outgoing query strings in debug builds to catch empty values"],"tags":["rooms","rest-api","validation","query-params"],"backgroundTag":"missing-required-argument","analyzedSha":"e4b8178b205510181a96ceefee043d0abcd13e5a","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}