RocketChat/Rocket.Chat · error · Error

Invalid message ID.

Error message

Invalid message ID.

What it means

Error "Invalid message ID." thrown in RocketChat/Rocket.Chat.

Source

Thrown at apps/meteor/server/lib/messages/updateMessage.ts:25

import { afterSaveMessage } from '../../hooks/messages/afterSaveMessage';
import { settings } from '../../settings';
import { validateCustomMessageFields } from '../messaging/validateCustomMessageFields';
import { notifyOnRoomChangedById } from '../notifyListener';

export const updateMessage = async function (
	{
		parseUrls,
		...message
	}: (AtLeast<IMessage, '_id' | 'rid' | 'msg' | 'customFields'> | AtLeast<IMessage, '_id' | 'rid' | 'content'>) & {
		parseUrls?: boolean;
	},
	user: IUser,
	originalMsg?: IMessage,
	previewUrls?: string[],
): Promise<void> {
	const originalMessage = originalMsg || (await Messages.findOneById(message._id));
	if (!originalMessage) {
		throw new Error('Invalid message ID.');
	}

	let messageData: IMessage = Object.assign({}, originalMessage, message);

	// For the Rocket.Chat Apps :)
	if (message && Apps.self && Apps.isLoaded()) {
		const prevent = await Apps.self?.triggerEvent(AppEvents.IPreMessageUpdatedPrevent, messageData);
		if (prevent) {
			throw new Meteor.Error('error-app-prevented-updating', 'A Rocket.Chat App prevented the message updating.');
		}

		let result = await Apps.self?.triggerEvent(AppEvents.IPreMessageUpdatedExtend, messageData);
		result = await Apps.self?.triggerEvent(AppEvents.IPreMessageUpdatedModify, result);

		if (typeof result === 'object') {
			Object.assign(messageData, result);
		}
	}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Pass the _id of an existing message to updateMessage; no message was found with the given id.
  2. Verify the message has not been deleted before attempting to update it.

When it happens

Trigger: Thrown at apps/meteor/server/lib/messages/updateMessage.ts:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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