{"record":{"id":"f30710ac8e6d2b98","repo":"RocketChat/Rocket.Chat","slug":"mention-bot-failed-to-retrieve-message-informati","errorCode":null,"errorMessage":"Mention bot - Failed to retrieve message information","messagePattern":"Mention bot - Failed to retrieve message information","errorType":"exception","errorClass":"Error","httpStatus":500,"severity":"warning","filePath":"apps/meteor/server/modules/core-apps/mention.module.ts","lineNumber":43,"sourceCode":"\tappId = 'mention-core';\n\n\tasync blockAction(payload: UiKitCoreAppBlockActionPayload): Promise<undefined> {\n\t\tconst {\n\t\t\tactionId,\n\t\t\tpayload: { value: stringifiedMentions, blockId: referenceMessageId },\n\t\t} = payload;\n\n\t\tconst user = payload.user!;\n\t\tconst room = payload.room!;\n\n\t\tconst mentions = retrieveMentionsFromPayload(stringifiedMentions as string);\n\n\t\tconst usernames = mentions.map(({ username }) => username);\n\n\t\tconst message = await Messages.findOneById(referenceMessageId, { projection: { _id: 1, tmid: 1 } });\n\n\t\tif (!message) {\n\t\t\tthrow new Error('Mention bot - Failed to retrieve message information');\n\t\t}\n\n\t\tconst joinedUsernames = `@${usernames.join(', @')}`;\n\n\t\tif (actionId === 'dismiss') {\n\t\t\tvoid api.broadcast('notify.ephemeralMessage', user._id, room, {\n\t\t\t\tmsg: i18n.t('You_mentioned___mentions__but_theyre_not_in_this_room', {\n\t\t\t\t\tmentions: joinedUsernames,\n\t\t\t\t\tlng: user.language,\n\t\t\t\t}),\n\t\t\t\t_id: payload.message,\n\t\t\t\ttmid: message.tmid,\n\t\t\t\tmentions,\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (actionId === 'add-users') {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/modules/core-apps/mention.module.ts#L25-L61","documentation":"In the `mention-core` blockAction handler, the `blockId` of the action is used as a reference message id: `Messages.findOneById(referenceMessageId, { projections: { _id: 1, tmid: 1 } })`. If the lookup returns null the module throws `Error('Mention bot - Failed to retrieve message information')` — the message the ephemeral mention prompt points at no longer exists (deleted, purged, or the blockId is not a real message id).","triggerScenarios":"A user clicks the mention prompt's action after the reference message was deleted; a retention/purge job removed the message between prompt render and click; a custom payload sets `blockId` to something that is not an existing message `_id`.","commonSituations":"Message deletion races with the ephemeral prompt; retention policies purging old messages while prompts are open; custom clients that set blockId incorrectly when building the mention prompt.","solutions":["Ensure the block action's `blockId` is the `_id` of an existing message when the prompt is built.","Client-side, dismiss or disable the ephemeral mention prompt when its reference message is removed.","Treat this error as benign when the message was legitimately deleted — catch and ignore it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { Messages } from '@rocket.chat/models';\n\nconst message = await Messages.findOneById(referenceMessageId, { projection: { _id: 1 } });\nif (!message) {\n  // reference message gone: skip the mention action instead of dispatching\n} else {\n  await mentionModule.blockAction(payload);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await mentionModule.blockAction(payload);\n} catch (error) {\n  if (error instanceof Error && error.message === 'Mention bot - Failed to retrieve message information') {\n    return; // reference message was deleted: benign stale-prompt case\n  }\n  throw error;\n}","preventionTips":["Set blockId to an existing message _id when building mention prompts","Dismiss ephemeral prompts when their reference message is removed","Treat this error as a no-op for deleted messages"],"tags":["uikit","mentions","messages","not-found","stale-data"],"backgroundTag":"message-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}