RocketChat/Rocket.Chat · error · Error

error-message-not-found

error-message-not-found

Error message

error-message-not-found

What it means

Thrown by GET /api/v1/push.get when Messages.findOneById(id) returns null — the `id` query param is not an existing message _id. The endpoint exists so clients can render the push notification for a specific message, so a wrong, truncated, or already-deleted message id fails here before the room lookup runs.

Solutions

  1. Only call push.get with ids that came from a live push payload or the user's own message stream
  2. Validate the id shape first (17-char alphanumeric Rocket.Chat id)
  3. On this error, dismiss the local notification instead of retrying — the message is gone
Defensive patterns

Strategy: validation

Validate before calling

const isMessageId = (id: unknown): id is string =>
  typeof id === 'string' && /^[A-Za-z0-9]{17}$/.test(id);
if (!isMessageId(id)) throw new Error(`malformed message id: ${JSON.stringify(id)}`);
// only fetch push info for ids that arrived in a push payload for THIS user
if (!pushPayloadIds.has(id)) throw new Error('message id not from a local push payload');

Type guard

const isRocketChatId = (v: unknown): v is string =>
  typeof v === 'string' && /^[A-Za-z0-9]{17}$/.test(v);

Try / catch

catch 'error-message-not-found' and dismiss the local notification silently — the message was deleted (retention/moderation) and retrying cannot bring it back.

Prevention

When it happens

Trigger: GET /api/v1/push.get?id=<messageId> with a mistyped/truncated id, a message deleted by retention or moderation before the client opened the notification, or an id from another workspace passed in.

Common situations: Notification tapped long after the message was pruned by retention policies; ids logged in one environment and replayed against another; message removed by a moderator while a batch notification job iterates ids.

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/745e9309f820c64f. Report an issue: GitHub.

Appendix: source

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

			authRequired: true,
			query: isPushGetProps,
			response: {
				200: pushGetResponseSchema,
				400: validateBadRequestErrorResponse,
				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',

View on GitHub (pinned to b2c16d5842)