{"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":106,"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":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/channels.ts#L88-L124","documentation":"Thrown by findChannelByIdOrName when no room matches the given roomId/roomName, or when the matched room's type is neither 'c' (channel) nor 'l' (livechat). This helper backs most channels.* endpoints, so the error appears whenever a caller targets a direct-message room, a private group ('p'), or a non-existent channel through a channels route.","triggerScenarios":"Calling a channels.* endpoint with a roomId/roomName that resolves to a room of type 'p' (private group) or 'd' (direct message), or that does not exist at all. Empty/blank roomId or roomName also yields no match.","commonSituations":"Using a groups.* identifier against a channels.* endpoint; typos in roomName; case sensitivity on room names; passing an _id that belongs to a team-private room.","solutions":["Use the groups.* or dm.* endpoints if the target is a private group or direct message.","Confirm the room type before routing the call (fetch via rooms.info and branch on room.t).","Double-check the roomId/roomName spelling and that the room still exists."],"exampleFix":"// before\nconst room = await findChannelByIdOrName({ params: { roomId } });\n\n// after - route by room type\nconst room = await Rooms.findOneById(roomId);\nif (!room) throw new Error('Room not found');\nif (room.t === 'p') {\n  return callGroupsEndpoint(roomId);\n}\nif (room.t === 'd') {\n  return callDmEndpoint(roomId);\n}\nconst channel = await findChannelByIdOrName({ params: { roomId } });","handlingStrategy":"validation","validationCode":"// Resolve and classify the room before choosing the endpoint family\nasync function resolveRoomEndpoint(roomIdOrName) {\n  const room = roomIdOrName._id\n    ? await Rooms.findOneById(roomIdOrName._id)\n    : await Rooms.findOneByName(roomIdOrName.name);\n  if (!room) throw new Error('Room not found');\n  if (room.t !== 'c' && room.t !== 'l') {\n    return { family: room.t === 'p' ? 'groups' : room.t === 'd' ? 'im' : null, room };\n  }\n  return { family: 'channels', room };\n}","typeGuard":"function isChannelLike(room) {\n  return Boolean(room) && (room.t === 'c' || room.t === 'l');\n}","tryCatchPattern":"try {\n  return await api.channels.info({ roomId });\n} catch (e) {\n  if (e.error === 'error-room-not-found') {\n    // Try the groups or im endpoints instead based on room type\n    const room = await Rooms.findOneById(roomId);\n    if (room?.t === 'p') return await api.groups.info({ roomId });\n    throw e;\n  }\n  throw e;\n}","preventionTips":["Branch on room.t before selecting channels.* vs groups.* vs im.*.","Validate roomId/roomName spelling and existence with rooms.info first.","Treat roomName lookups as case-sensitive."],"tags":["channels","room-lookup","rest-api","validation"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}