RocketChat/Rocket.Chat · error · Meteor.Error

error-this-is-not-a-livechat-room

error-this-is-not-a-livechat-room

Error message

error-this-is-not-a-livechat-room

What it means

After the room is found, removeOmnichannelRoom validates it with isOmnichannelRoom(room); non-omnichannel rooms (channels, teams, direct messages) are rejected with Meteor.Error('error-this-is-not-a-livechat-room') before deletion.

Source

Thrown at apps/meteor/server/lib/omnichannel/rooms.ts:279

		livechatLogger.error({ err });
		throw new Meteor.Error('error-returning-inquiry');
	}

	callbacks.runAsync('livechat:afterReturnRoomAsInquiry', { room });

	return true;
}

export async function removeOmnichannelRoom(rid: string) {
	livechatLogger.debug({ msg: 'Deleting room', roomId: rid });
	check(rid, String);
	const room = await LivechatRooms.findOneById(rid);
	if (!room) {
		throw new Meteor.Error('error-invalid-room', 'Invalid room');
	}

	if (!isOmnichannelRoom(room)) {
		throw new Meteor.Error('error-this-is-not-a-livechat-room');
	}

	if (room.open) {
		throw new Meteor.Error('error-room-is-not-closed');
	}

	const inquiry = await LivechatInquiry.findOneByRoomId(rid);

	const result = await Promise.allSettled([
		Messages.removeByRoomId(rid),
		ReadReceipts.removeByRoomId(rid),
		Subscriptions.removeByRoomId(rid, {
			async onTrash(doc) {
				void notifyOnSubscriptionChanged(doc, 'removed');
			},
		}),
		LivechatInquiry.removeByRoomId(rid),
		LivechatRooms.removeById(rid),

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Route deletion by room type: use the omnichannel removal flow only for livechat rooms (room.t === 'l').
  2. Check room.t before calling removeOmnichannelRoom.
  3. Use the appropriate deletion endpoint for non-omnichannel rooms.

Example fix

// before
await removeOmnichannelRoom(rid); // rid belongs to a channel -> error-this-is-not-a-livechat-room

// after
const room = await LivechatRooms.findOneById(rid);
if (room?.t !== 'l') {
	throw new Error('not an omnichannel room');
}
await removeOmnichannelRoom(rid);
Defensive patterns

Strategy: type-guard

Validate before calling

const room = await LivechatRooms.findOneById(rid, { projection: { _id: 1, t: 1 } });
if (!room || room.t !== 'l') {
	throw new Error('not an omnichannel room');
}
await removeOmnichannelRoom(rid);

Type guard

const isOmnichannelRoomById = async (rid: string): Promise<boolean> => {
	const room = await LivechatRooms.findOneById(rid, { projection: { t: 1 } });
	return room?.t === 'l';
};

Try / catch

try {
	await removeOmnichannelRoom(rid);
} catch (err) {
	if (err instanceof Meteor.Error && err.error === 'error-this-is-not-a-livechat-room') {
		// route this rid to the non-omnichannel deletion path instead
		return;
	}
	throw err;
}

Prevention

When it happens

Trigger: Passing the rid of a regular channel, team, or DM into the omnichannel room removal flow.

Common situations: Integrations reuse one generic 'delete room' routine for all room types; a UI list mixes omnichannel conversations with normal rooms and passes the wrong id.

Related errors


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