RocketChat/Rocket.Chat · error · Meteor.Error
error-message-not-found
error-message-not-found
Error message
Message not found
What it means
'autoTranslate.translateMessage' resolves the message via Messages.findOneById(message._id) and throws error-message-not-found when no document matches. It fires after auth and check() succeed, so it is purely a data-lookup failure: the _id the client sent does not exist (anymore) in the Messages collection. Most often the message was deleted or pruned after the client rendered it.
Source
Thrown at apps/meteor/server/meteor-methods/platform/translateMessage.ts:29
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'autoTranslate.translateMessage'(message: IMessage | undefined, targetLanguage: string): Promise<IMessage | undefined>;
}
}
Meteor.methods<ServerMethods>({
async 'autoTranslate.translateMessage'(message, targetLanguage) {
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'autoTranslate.translateMessage',
});
}
check(message?._id, String);
check(targetLanguage, String);
const msg = await Messages.findOneById(message._id);
if (!msg) {
throw new Meteor.Error('error-message-not-found', 'Message not found');
}
const room = await Rooms.findOneById(msg.rid);
if (!room || !(await canAccessRoomAsync(room, { _id: userId }))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed');
}
return translateMessage(targetLanguage, msg);
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Re-fetch the message by _id (or revalidate against the local message store) before offering/performing translation.
- Catch the error and degrade gracefully - hide the translate action or show 'message no longer available'.
- If it reproduces consistently, log the exact _id sent and compare it with the document in the Messages collection.
Defensive patterns
Strategy: try-catch
Validate before calling
// client-side: confirm the message is still in the local store before translating
if (!message?._id || !RocketChat.models?.Messages?.findOne(message._id)) {
// message no longer available - skip translation
} Try / catch
try {
await Meteor.callAsync('autoTranslate.translateMessage', { _id }, lang);
} catch (e: any) {
if (e?.error === 'error-message-not-found') {
// drop the message from local state; do not retry with the same id
}
} Prevention
- Remove deleted messages from local state when delete events arrive.
- Revalidate the _id against the message cache right before calling.
- Treat not-found as terminal - never auto-retry the same id.
When it happens
Trigger: Translating a message that was deleted, pruned, or removed by moderation after it was rendered; passing a fabricated or truncated _id; racing a message purge job.
Common situations: Stale message lists in long-open channels; messages deleted by moderators while a user hovered the translate action; imports/migrations where message _ids changed.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- error-message-not-found
- error-invalid-room
- error-application-not-found
- error-operation-not-found
- error-operation-not-found
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/6299fb443636e82a.
Report an issue: GitHub.