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 findRoomByIdOrName when the lookup (Rooms.findOneById for roomId, or Rooms.findOneByName for roomName) returns null. The identifier was provided but matches no room. Returns a structured Meteor.Error('error-room-not-found', ...).

Source

Thrown at apps/meteor/server/api/v1/rooms.ts:127

}): Promise<IRoom> {
	if (
		(!('roomId' in params) && !('roomName' in params)) ||
		('roomId' in params && !(params as { roomId?: string }).roomId && 'roomName' in params && !(params as { roomName?: string }).roomName)
	) {
		throw new Meteor.Error('error-roomid-param-not-provided', 'The parameter "roomId" or "roomName" is required');
	}

	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) {
		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`);
	}

	return room;
}

API.v1.get(
	'rooms.nameExists',
	{
		authRequired: true,
		query: isGETRoomsNameExists,
		response: {
			200: ajv.compile<{ exists: boolean }>({
				type: 'object',
				properties: {
					exists: { type: 'boolean' },

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Verify the room via rooms.nameExists or rooms.info before the call.
  2. Refresh the room list the client derived the id/name from.
  3. Distinguish case-sensitive room names and leading/trailing whitespace.

Example fix

// before
fetch('/api/v1/<endpoint>', { method:'POST', body: JSON.stringify({ roomName }) });

// after
const { exists } = await fetch(`/api/v1/rooms.nameExists?roomName=${encodeURIComponent(roomName)}`).then(r=>r.json());
if (!exists) throw new Error(`room not found: ${roomName}`);
fetch('/api/v1/<endpoint>', { method:'POST', body: JSON.stringify({ roomName }) });
Defensive patterns

Strategy: validation

Validate before calling

// Verify the room exists before the operation
const { exists } = await fetch(`/api/v1/rooms.nameExists?roomName=${encodeURIComponent(roomName)}`).then(r => r.json());
if (!exists) throw new Error(`room not found: ${roomName}`);
// proceed with the findRoomByIdOrName-backed call

Try / catch

try {
  await fetch(endpoint).then(r => r.json());
} catch (e) {
  if (e.error === 'error-room-not-found') { /* refresh room list; do not retry same id */ }
}

Prevention

When it happens

Trigger: Calling a findRoomByIdOrName-backed endpoint with a roomId/roomName that does not correspond to any channel/private group/dm (typo, deleted room, wrong workspace).

Common situations: Stale cached room id/name; room archived+deleted; caller confuses display name with the canonical room name; cross-workspace id.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/2efd55ddd00a9fda. Report an issue: GitHub.