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 group

What it means

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.

Solutions

  1. Verify the room type first with rooms/info or im/channels endpoints - if t is 'c' use channels.* endpoints, if 'd' use im.* endpoints
  2. Pass the exact _id (safest) rather than the name to avoid casing/special-character mismatches
  3. Confirm the room exists on this server and was not deleted (check via rooms/info with the same credentials)

Example fix

// before
await sdk.post('groups.addModerator', { roomId: channelRoomId, username }); // channel -> error

// after
const { roomInfo } = await sdk.get('rooms.info', { roomId });
const route = roomInfo.t === 'p' ? 'groups.addModerator' : 'channels.addModerator';
await sdk.post(route, { roomId, username });
Defensive patterns

Strategy: type-guard

Validate before calling

const { roomInfo } = await sdk.get('rooms.info', { roomId });
if (roomInfo.t !== 'p') throw new Error(`room ${roomId} is type '${roomInfo.t}'; use the matching endpoint family`);

Type guard

const isPrivateGroup = (room: { t: string }): room is { t: 'p' } & typeof room => room.t === 'p';
const apiFamilyFor = (t: string) => ({ p: 'groups', c: 'channels', d: 'im', l: 'channels' } as const)[t] ?? 'rooms';

Try / catch

try { await sdk.post('groups.addModerator', body); } catch (e) {
  if (e.error === 'error-room-not-found') { /* re-check rooms/info; maybe wrong endpoint family */ }
}

Prevention

When it happens

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

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

Related errors


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

Appendix: source

Thrown at apps/meteor/server/api/v1/groups.ts:100

			name: 1,
			fname: 1,
			prid: 1,
			archived: 1,
			broadcast: 1,
		},
	};

	const room = await (() => {
		if ('roomId' in params) {
			return Rooms.findOneById(params.roomId || '', roomOptions);
		}
		if ('roomName' in params) {
			return Rooms.findOneByName(params.roomName || '', roomOptions);
		}
	})();

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

	return room;
}

// Returns the private group subscription IF found otherwise it will return the failure of why it didn't. Check the `statusCode` property
async function findPrivateGroupByIdOrName({
	params,
	checkedArchived = true,
	userId,
}: {
	params:
		| {
				roomId?: string;
		  }
		| {
				roomName?: string;
		  };

View on GitHub (pinned to e4b8178b20)