RocketChat/Rocket.Chat · error · Error

error-room-not-found

error-room-not-found

Error message

error-room-not-found

What it means

Thrown by GET /api/v1/push.get when the message exists but Rooms.findOneById(message.rid) returns null — the room the message belongs to no longer exists. This is a data-inconsistency case (or the room was deleted while its messages survived in a trash/retention window): normally deleting a room removes its messages, so hitting this error usually means deletion happened between the two lookups or a partial cleanup occurred.

Solutions

  1. Don't retry — the room is gone; drop the notification from the client's queue
  2. If this fires repeatedly, audit for a partial deletion (messages collection rows whose rid has no room) and clean them
  3. Stagger retention jobs vs push delivery windows if the race is systemic
Defensive patterns

Strategy: try-catch

Try / catch

catch 'error-room-not-found' and drop the notification plus any cached messages for that rid; if it recurs across many messages, escalate as a data-integrity issue (orphaned messages) rather than a client error.

Prevention

When it happens

Trigger: GET /api/v1/push.get?id=<messageId> where the room was deleted (admin purge, retention job) after the message row was selected; database restored inconsistently; message untrash'd without its room.

Common situations: Retention jobs pruning rooms while queued push notifications still reference their messages; admin room deletions racing notification opens; backup/restore mismatches in dev environments.

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/86dfab2e5f1a0382. Report an issue: GitHub.

Appendix: source

Thrown at apps/meteor/server/api/v1/push.ts:316

				401: validateUnauthorizedErrorResponse,
			},
		},
		async function action() {
			const { id } = this.queryParams;

			const receiver = await Users.findOneById(this.userId);
			if (!receiver) {
				throw new Error('error-user-not-found');
			}

			const message = await Messages.findOneById(id);
			if (!message) {
				throw new Error('error-message-not-found');
			}

			const room = await Rooms.findOneById(message.rid);
			if (!room) {
				throw new Error('error-room-not-found');
			}

			if (!(await canAccessRoomAsync(room, receiver))) {
				throw new Error('error-not-allowed');
			}

			const data = await PushNotification.getNotificationForMessageId({ receiver, room, message });

			return API.v1.success({ data });
		},
	)
	.get(
		'push.info',
		{
			authRequired: true,
			response: {
				200: pushInfoResponseSchema,
				401: validateUnauthorizedErrorResponse,

View on GitHub (pinned to b2c16d5842)