RocketChat/Rocket.Chat · error · Error

error-invalid-room

Error message

error-invalid-room

What it means

Thrown by DELETE /api/v1/livechat/transcript/:rid when the room does not exist OR is not open (the check is !room?.open). You can only cancel a transcript request on a currently open livechat room. A closed room, a nonexistent rid, or a malformed rid all produce this error.

Solutions

  1. Fetch the room first (e.g. GET /api/v1/livechat/rooms and match on rid, or livechat room endpoints) and confirm it is open before deleting the transcript request
  2. If the room already closed, there is nothing to cancel — treat this as success in your flow
  3. Double-check the rid is the full room id from the same workspace
Defensive patterns

Strategy: validation

Validate before calling

const room = await (await fetch(`${server}/api/v1/livechat/room/${rid}`, { headers })).json();
if (!room?.room?.open) skipTranscriptCancel(); // deleting requires an OPEN room

Type guard

const isOpenRoom = (r: unknown): r is { _id: string; open: true } =>
  !!r && typeof r === 'object' && (r as any).open === true;

Try / catch

const body = await (await fetch(`${server}/api/v1/livechat/transcript/${rid}`, { method: 'DELETE', headers })).json();
if (!body.success && body.error === 'error-invalid-room') { /* room missing/closed: treat cancel as done */ }

Prevention

When it happens

Trigger: DELETE /api/v1/livechat/transcript/<rid> after the conversation was closed (by agent, visitor, or inactivity); using an rid from the wrong environment; typos in the room id; calling delete twice after the room closed between calls.

Common situations: Race where the chat closes while your integration is mid-flow (visitor left, room closed by closetimeout); stale rid captured from an earlier test run against a re-seeded database.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at apps/meteor/server/api/v1/omnichannel/transcript.ts:42

API.v1.addRoute(
	'livechat/transcript/:rid',
	{
		authRequired: true,
		permissionsRequired: ['send-omnichannel-chat-transcript'],
		validateParams: {
			POST: isPOSTLivechatTranscriptRequestParams,
		},
	},
	{
		async delete() {
			const { rid } = this.urlParams;
			const room = await LivechatRooms.findOneById<Pick<IOmnichannelRoom, 'open' | 'transcriptRequest' | 'v'>>(rid, {
				projection: { open: 1, transcriptRequest: 1, v: 1 },
			});

			if (!room?.open) {
				throw new Error('error-invalid-room');
			}
			if (!room.transcriptRequest) {
				throw new Error('error-transcript-not-requested');
			}

			if (!(await Omnichannel.isWithinMACLimit(room))) {
				throw new Error('error-mac-limit-reached');
			}

			await LivechatRooms.unsetEmailTranscriptRequestedByRoomId(rid);

			return API.v1.success();
		},
		async post() {
			const { rid } = this.urlParams;
			const { email, subject } = this.bodyParams;

			const user = await Users.findOneById(this.userId, {

View on GitHub (pinned to b2c16d5842)