RocketChat/Rocket.Chat · error · Meteor.Error

error-room-does-not-exist

error-room-does-not-exist

Error message

This room does not exist

What it means

readThreads resolves the thread message by tmid and then loads its parent room with Rooms.findOneById(thread.rid). If that lookup returns null the method throws error-room-does-not-exist: the thread message still exists but the room record it points to is gone, so the server cannot authorize or mark the read.

Source

Thrown at apps/meteor/server/meteor-methods/messages/readThreads.ts:41

		check(tmid, String);

		if (!Meteor.userId() || !settings.get('Threads_enabled')) {
			throw new Meteor.Error('error-not-allowed', 'Threads Disabled', {
				method: 'getThreadMessages',
			});
		}

		const thread = await Messages.findOneById(tmid);
		if (!thread) {
			return;
		}

		const user = (await Meteor.userAsync()) ?? undefined;

		const room = await Rooms.findOneById(thread.rid);
		if (!room) {
			throw new Meteor.Error('error-room-does-not-exist', 'This room does not exist', { method: 'getThreadMessages' });
		}

		if (!(await canAccessRoomAsync(room, user))) {
			throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'getThreadMessages' });
		}

		await callbacks.run('beforeReadMessages', thread.rid, user?._id);
		if (user?._id) {
			await readThread({ user: user as IUser, room, tmid });
		}
	},
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Verify the thread's room still exists before marking the thread read; treat missing rooms as stale client state
  2. Find and repair orphaned messages (Messages whose rid has no Rooms entry) or delete them
  3. Refresh client caches so deleted rooms disappear from the UI and the call is never made
Defensive patterns

Strategy: try-catch

Try / catch

try {
	await Meteor.callAsync('readThreads', tmid);
} catch (e: any) {
	if (e?.error === 'error-room-does-not-exist') {
		// orphaned thread: room was deleted, close the thread panel and forget tmid
		closeThread(tmid);
		return;
	}
	throw e;
}

Prevention

When it happens

Trigger: Calling readThreads with a tmid whose room was deleted while thread messages survived (incomplete cascade delete); data drift after a failed import or partial restore where Messages were copied without their Rooms; tmid from another workspace after database surgery.

Common situations: Client keeps a thread panel open from cache after the room was deleted; retention/pruning jobs removed rooms but not all thread messages; imports that replicated messages without enforcing room references.

Related errors


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