RocketChat/Rocket.Chat · error · Meteor.Error

error-room-not-found

error-room-not-found

Error message

The required "roomId" or "roomName" param provided does not match any channel

What it means

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.

Solutions

  1. Use groups.* endpoints for private groups and im.* for DMs — channels.* only serves 'c' and 'l' rooms
  2. Fetch the correct identifier via GET /api/v1/rooms.info or channels.list and use the returned _id
  3. Double-check name casing and that the room still exists and is visible to the calling user

Example fix

// before
GET /api/v1/channels.info?roomName=General  // 404 error-room-not-found (room is actually a private group)

// after
GET /api/v1/groups.info?roomName=General
Defensive patterns

Strategy: type-guard

Validate before calling

const room = await GET('/api/v1/rooms.info', { roomNameOrId: name });
if (!room || (room.t !== 'c' && room.t !== 'l')) {
  throw new Error(`Use ${room?.t === 'p' ? 'groups' : 'im'}.info instead`);
}

Type guard

const isChannelRoom = (room: { t: string }): boolean => room.t === 'c' || room.t === 'l';

Try / catch

try { /* channels.* call */ } catch (e) {
  if (e.error === 'error-room-not-found') { /* verify room type via rooms.info */ }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@e4b8178b20 (2026-08-18). Data as JSON: /api/errors/9be13e3c62fe9b4f. Report an issue: GitHub.

Appendix: source

Thrown at apps/meteor/server/api/v1/channels.ts:107

				roomId?: string;
		  }
		| {
				roomName?: string;
		  };
	userId?: string;
	checkedArchived?: boolean;
}): Promise<IRoom> {
	const projection = { ...API.v1.defaultFieldsToExclude };

	let room;
	if ('roomId' in params) {
		room = await Rooms.findOneById(params.roomId || '', { projection });
	} else if ('roomName' in params) {
		room = await Rooms.findOneByName(params.roomName || '', { projection });
	}

	if (!room || (room.t !== 'c' && room.t !== 'l')) {
		throw new Meteor.Error('error-room-not-found', 'The required "roomId" or "roomName" param provided does not match any channel');
	}

	if (checkedArchived && room.archived) {
		throw new Meteor.Error('error-room-archived', `The channel, ${room.name}, is archived`);
	}
	if (userId && room.lastMessage) {
		const [lastMessage] = await normalizeMessagesForUser([room.lastMessage], userId);
		room.lastMessage = lastMessage;
	}

	return room;
}

const channelResponseSchema = ajv.compile<{ channel: IRoom }>({
	type: 'object',
	properties: {
		channel: { $ref: '#/components/schemas/IRoom' },
		success: { type: 'boolean', enum: [true] },

View on GitHub (pinned to e4b8178b20)