RocketChat/Rocket.Chat · error · Error
Mention bot - Failed to retrieve room information
Error message
Mention bot - Failed to retrieve room information
What it means
Thrown by Rocket.Chat's mention bot core app (MentionModule, appId 'mention-core'). When a user clicks 'share-message' on the banner shown after mentioning users who cannot see the room, the module loads the clicker's own subscription via Subscriptions.findOneByRoomIdAndUserId(room, user._id) to build a deep link to the message. A null result means the server no longer considers this user a member of the room the banner was rendered in, so the share is aborted.
Source
Thrown at apps/meteor/server/modules/core-apps/mention.module.ts:79
if (actionId === 'add-users') {
void addUsersToRoomMethod(user._id, { rid: room, users: usernames as string[] }, user);
void api.broadcast('notify.ephemeralMessage', user._id, room, {
msg: i18n.t('You_mentioned___mentions__but_theyre_not_in_this_room', {
mentions: joinedUsernames,
lng: user.language,
}),
tmid: message.tmid,
_id: payload.message,
mentions,
});
return undefined;
}
if (actionId === 'share-message') {
const sub = await Subscriptions.findOneByRoomIdAndUserId(room, user._id, { projection: { t: 1, rid: 1, name: 1 } });
// this should exist since the event is fired from withing the room (e.g the user sent a message)
if (!sub) {
throw new Error('Mention bot - Failed to retrieve room information');
}
const roomPath = roomCoordinator.getRouteLink(sub.t, { rid: sub.rid, name: sub.name });
if (!roomPath) {
throw new Error('Mention bot - Failed to retrieve path to room');
}
const messageText = i18n.t('Youre_not_a_part_of__channel__and_I_mentioned_you_there', {
channel: `#${sub.name}`,
lng: user.language,
});
const link = new URL(Meteor.absoluteUrl(roomPath));
link.searchParams.set('msg', message._id);
const text = `[ ](${link.toString()})\n${messageText}`;
// forwards message to all DMs
await processWebhookMessage(View on GitHub (pinned to b2c16d5842)
Solutions
- Re-check that the user is still a member of the room before showing or handling 'share-message', and hide the action if not
- If membership was lost, have the user rejoin the room, re-send the mention, and use the fresh banner
- Catch the error where UiKit actions are executed and reply with an ephemeral 'you are no longer in this room' notice instead of surfacing a server error
- If it reproduces for an active member, inspect the subscriptions collection for a missing/corrupt document for that rid+uid pair
Example fix
// before
await mentionModule.blockAction(payload); // may throw 'Mention bot - Failed to retrieve room information'
// after
const sub = await Subscriptions.findOneByRoomIdAndUserId(payload.room!, payload.user!._id, { projection: { t: 1 } });
if (!sub) {
void api.broadcast('notify.ephemeralMessage', payload.user!._id, payload.room!, { msg: 'You are no longer in this room' });
return;
}
await mentionModule.blockAction(payload); Defensive patterns
Strategy: try-catch
Validate before calling
const canShareMessage = async (userId: string, rid: string): Promise<boolean> =>
Boolean(await Subscriptions.findOneByRoomIdAndUserId(rid, userId, { projection: { _id: 1 } })); Try / catch
try {
await mentionModule.blockAction(payload);
} catch (error) {
if (error instanceof Error && error.message === 'Mention bot - Failed to retrieve room information') {
// user lost membership mid-flow; show an ephemeral notice instead of failing
return notifyMembershipLost(payload.user!._id, payload.room!);
}
throw error;
} Prevention
- Re-verify room membership at click time, not only at banner-render time
- In custom clients, drop UiKit banners as soon as the local subscription for that room is removed
- Never cache the room id in the banner payload beyond the session that rendered it
When it happens
Trigger: A UiKit blockAction dispatched with appId 'mention-core' and actionId 'share-message' where Subscriptions.findOneByRoomIdAndUserId(payload.room, user._id) returns null: the user left or was removed from the channel after the banner rendered, or the payload carries a stale/incorrect room id.
Common situations: User leaves (or is kicked from) a channel while the 'you mentioned users not in this room' banner is still on screen, then clicks Share; hand-built UiKit payloads in tests pointing at a room the user never joined.
Related errors
- Mention bot - Failed to retrieve path to room
- Invalid payload
- Invalid app provided
- Type not supported
- error-roomId-param-invalid
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/78491f68ea3c3dbd.
Report an issue: GitHub.