{"record":{"id":"d9d0713aad99139d","repo":"RocketChat/Rocket.Chat","slug":"error-room-not-found-d9d071","errorCode":"error-room-not-found","errorMessage":"The required \"roomId\" or \"roomName\" param provided does not match any group","messagePattern":"The required \"roomId\" or \"roomName\" param provided does not match any group","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/groups.ts","lineNumber":100,"sourceCode":"\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);\n\t\t}\n\t\tif ('roomName' in params) {\n\t\t\treturn Rooms.findOneByName(params.roomName || '', roomOptions);\n\t\t}\n\t})();\n\n\tif (room?.t !== 'p') {\n\t\tthrow new Meteor.Error('error-room-not-found', 'The required \"roomId\" or \"roomName\" param provided does not match any group');\n\t}\n\n\treturn room;\n}\n\n// Returns the private group subscription IF found otherwise it will return the failure of why it didn't. Check the `statusCode` property\nasync function findPrivateGroupByIdOrName({\n\tparams,\n\tcheckedArchived = true,\n\tuserId,\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  };","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/api/v1/groups.ts#L82-L118","documentation":"Thrown by getRoomFromParams when the roomId/roomName lookup (Rooms.findOneById / findOneByName) returns null OR returns a room whose type t is not 'p'. The groups.* API is scoped to private channels (groups); public channels ('c'), direct messages ('d'), discussions, livestream and team rooms all fail here even though they exist.","triggerScenarios":"Calling groups.addAll / groups.addModerator etc. with roomId of the public channel GENERAL; passing a direct-message room id; passing roomName of a public channel like 'general' (name lookup is case-sensitive on most deployments); a room id that was deleted or belongs to another workspace.","commonSituations":"Assuming every room is a 'group' because the UI calls them that; mixing up channels.* and groups.* SDK helpers after copying example code; using room names with wrong casing; handling a room id from a federated or imported workspace that does not exist locally.","solutions":["Verify the room type first with rooms/info or im/channels endpoints - if t is 'c' use channels.* endpoints, if 'd' use im.* endpoints","Pass the exact _id (safest) rather than the name to avoid casing/special-character mismatches","Confirm the room exists on this server and was not deleted (check via rooms/info with the same credentials)"],"exampleFix":"// before\nawait sdk.post('groups.addModerator', { roomId: channelRoomId, username }); // channel -> error\n\n// after\nconst { roomInfo } = await sdk.get('rooms.info', { roomId });\nconst route = roomInfo.t === 'p' ? 'groups.addModerator' : 'channels.addModerator';\nawait sdk.post(route, { roomId, username });","handlingStrategy":"type-guard","validationCode":"const { roomInfo } = await sdk.get('rooms.info', { roomId });\nif (roomInfo.t !== 'p') throw new Error(`room ${roomId} is type '${roomInfo.t}'; use the matching endpoint family`);","typeGuard":"const isPrivateGroup = (room: { t: string }): room is { t: 'p' } & typeof room => room.t === 'p';\nconst apiFamilyFor = (t: string) => ({ p: 'groups', c: 'channels', d: 'im', l: 'channels' } as const)[t] ?? 'rooms';","tryCatchPattern":"try { await sdk.post('groups.addModerator', body); } catch (e) {\n  if (e.error === 'error-room-not-found') { /* re-check rooms/info; maybe wrong endpoint family */ }\n}","preventionTips":["Store the room type alongside every room id in your app state","Derive the endpoint family (groups/channels/im) from room.t instead of hardcoding","Use ids, not names - names are case-sensitive and change on rename"],"tags":["rest-api","groups","room-type","not-found"],"backgroundTag":"room-not-found","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"}