RocketChat/Rocket.Chat · error · Meteor.Error
Room doesn't exist
Room doesn't exist
Error message
Room doesn't exist
What it means
Meteor.Error 'Room doesn't exist' thrown by auditGetMessagesMethod when type !== 'u' and getRoomInfoByAuditParams returns nothing — no room matches the combination of type, roomId, usernames, visitor, agent and the auditor's context. The audit search needs at least one concrete room id set before querying messages, so unmatched filters abort.
Solutions
- Re-check the filter values (exact usernames, rid, visitor/agent ids) against current data
- Search by the current room members' usernames if handles were renamed
- If the room was deleted, audit from retained message exports rather than the live room lookup
Example fix
// before: auditing with possibly stale identifiers
Meteor.call('auditMessages', { type: 'd', users: ['alice', 'bob'], startDate, endDate });
// after: confirm the room resolvable first (user type path needs no room)
const roomInfo = await getRoomInfoByAuditParams({ type: 'd', roomId: '', users: ['alice', 'bob'], visitor: '', agent: '', userId: auditorId });
if (!roomInfo) throw new Error('No room matches those audit filters');
Meteor.call('auditMessages', { type: 'd', users: ['alice', 'bob'], startDate, endDate }); Defensive patterns
Strategy: validation
Validate before calling
const auditFiltersMatchRoom = async (params: {
type: string; rid?: string; users: string[]; visitor?: string; agent?: string; userId: string;
}): Promise<boolean> =>
Boolean(await getRoomInfoByAuditParams({
type: params.type,
roomId: params.rid ?? '',
users: params.users,
visitor: params.visitor ?? '',
agent: params.agent ?? '',
userId: params.userId,
})); Try / catch
try {
const messages = await auditGetMessagesMethod(userId, params);
} catch (err: any) {
if (err?.error === "Room doesn't exist" || err?.reason === "Room doesn't exist") {
// verify usernames/rid/visitor ids; renamed users and deleted rooms cause this
}
throw err;
} Prevention
- Resolve current usernames via the user API before auditing DMs
- Prefer auditing by concrete rid where possible
- For deleted rooms, rely on exported/retained messages instead of live lookups
When it happens
Trigger: Auditing by room type/users/visitor/agent where the referenced room was deleted or the usernames/visitor id don't correspond to any room members; passing a rid that no longer exists; typos in usernames or stale visitor ids.
Common situations: Auditing retention-purged rooms; visitor/agent ids copied from another environment; searching direct messages between users where one username changed.
Related errors
- Not allowed
- App could not be enabled
- App metadata download failed
- App package download failed
- error-action-not-allowed
AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18).
Data as JSON: /api/errors/cbaed3c6031e6edd.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/ee/server/lib/audit/functions.ts:121
const usersId = await getUsersIdFromUserName(usernames);
query['u._id'] = { $in: usersId };
const abacRooms = await Rooms.findAllPrivateRoomsWithAbacAttributes({ projection: { _id: 1 } })
.map((doc) => doc._id)
.toArray();
query.rid = { $nin: abacRooms };
} else {
const roomInfo = await getRoomInfoByAuditParams({
type,
roomId: rid ?? '',
users: usernames,
visitor: visitor ?? '',
agent: agent ?? '',
userId: user._id,
});
if (!roomInfo) {
throw new Meteor.Error(`Room doesn't exist`);
}
rids = roomInfo.rids;
name = roomInfo.name;
query.rid = { $in: rids };
}
if (msg) {
const regex = new RegExp(escapeRegExp(msg).trim(), 'i');
query.msg = regex;
}
const messages = await Messages.find(query).toArray();
await AuditLog.insertOne(
{
ts: new Date(),
results: messages.length,View on GitHub (pinned to 2a7de45707)