{"record":{"id":"9be13e3c62fe9b4f","repo":"RocketChat/Rocket.Chat","slug":"error-room-not-found","errorCode":"error-room-not-found","errorMessage":"The required \"roomId\" or \"roomName\" param provided does not match any channel","messagePattern":"The required \"roomId\" or \"roomName\" param provided does not match any channel","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/channels.ts","lineNumber":107,"sourceCode":"\t\t\t\troomId?: string;\n\t\t  }\n\t\t| {\n\t\t\t\troomName?: string;\n\t\t  };\n\tuserId?: string;\n\tcheckedArchived?: boolean;\n}): Promise<IRoom> {\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 || (room.t !== 'c' && room.t !== 'l')) {\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\n\tif (checkedArchived && room.archived) {\n\t\tthrow new Meteor.Error('error-room-archived', `The channel, ${room.name}, is archived`);\n\t}\n\tif (userId && room.lastMessage) {\n\t\tconst [lastMessage] = await normalizeMessagesForUser([room.lastMessage], userId);\n\t\troom.lastMessage = lastMessage;\n\t}\n\n\treturn room;\n}\n\nconst channelResponseSchema = ajv.compile<{ channel: IRoom }>({\n\ttype: 'object',\n\tproperties: {\n\t\tchannel: { $ref: '#/components/schemas/IRoom' },\n\t\tsuccess: { type: 'boolean', enum: [true] },","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/api/v1/channels.ts#L89-L125","documentation":"Thrown by the findChannelByIdOrName helper used across channels.* REST endpoints when no room matches the roomId/roomName parameter, or the matched room is not a public channel or livechat channel (room.t must be 'c' or 'l'). It tells the caller the identifier is wrong for a channels.* call — private groups, teams, and DMs are rejected here.","triggerScenarios":"GET/POST channels.info, channels.history, channels.members, channels.archive, etc. with a roomId/roomName that does not exist, refers to a private group ('p'), a team ('p' under the hood), or a direct message ('d'); passing both params where roomId wins; passing a name where an ID is expected.","commonSituations":"Calling channels.* endpoints with a group/team ID fetched from groups.* or teams.* APIs; case-sensitive name mismatch; room was deleted or the user has no access so findOne returns nothing; copy-pasting the room URL slug instead of the actual room name.","solutions":["Use groups.* endpoints for private groups and im.* for DMs — channels.* only serves 'c' and 'l' rooms","Fetch the correct identifier via GET /api/v1/rooms.info or channels.list and use the returned _id","Double-check name casing and that the room still exists and is visible to the calling user"],"exampleFix":"// before\nGET /api/v1/channels.info?roomName=General  // 404 error-room-not-found (room is actually a private group)\n\n// after\nGET /api/v1/groups.info?roomName=General","handlingStrategy":"type-guard","validationCode":"const room = await GET('/api/v1/rooms.info', { roomNameOrId: name });\nif (!room || (room.t !== 'c' && room.t !== 'l')) {\n  throw new Error(`Use ${room?.t === 'p' ? 'groups' : 'im'}.info instead`);\n}","typeGuard":"const isChannelRoom = (room: { t: string }): boolean => room.t === 'c' || room.t === 'l';","tryCatchPattern":"try { /* channels.* call */ } catch (e) {\n  if (e.error === 'error-room-not-found') { /* verify room type via rooms.info */ }\n}","preventionTips":["Resolve rooms once via rooms.info and route by room type (c/l -> channels.*, p -> groups.*, d -> im.*)","Prefer roomId over roomName to avoid case-sensitivity mismatches","Remember the user must be able to see the room or lookup returns nothing"],"tags":["rest-api","channels","room-lookup","rocket-chat"],"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"}