RocketChat/Rocket.Chat · error · Meteor.Error
Room doesn't exist
Room doesn't exist
Error message
Room doesn't exist
What it means
Thrown by auditGetMessagesMethod (functions.ts:122) when getRoomInfoByAuditParams returns undefined — meaning no room matches the supplied rid/type/users/visitor/agent combination. Meteor.Error code 'Room doesn't exist'. This branch runs for every type except 'u' (user-message audit).
Source
Thrown at apps/meteor/ee/server/lib/audit/functions.ts:122
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 f9d3ec372b)
Solutions
- Validate that the rid exists and is not ABAC-protected before submitting the audit request.
- For type 'd', confirm the listed usernames actually share a direct message room.
- For type 'l', confirm the visitor/agent pairing has at least one LivechatRooms document.
- Treat as user input error — surface 'no such room' to the operator rather than retrying.
Example fix
// before: assume rid is valid
await auditGetMessagesMethod(userId, { rid, type: 'c', startDate, endDate });
// after: guard before calling
const room = await Rooms.findOneById(rid);
if (!room || room.abacAttributes) {
return notifyCaller('Room not available for audit');
}
await auditGetMessagesMethod(userId, { rid, type: room.t, startDate, endDate }); Defensive patterns
Strategy: validation
Validate before calling
async function resolveAuditRoom({ rid, type, users, visitor, agent }) {
if (rid) { const r = await Rooms.findOne({ _id: rid, abacAttributes: { $exists: false } }); if (!r) return null; }
if (type === 'd') return await Rooms.findDirectRoomContainingAllUsernames(users);
if (type === 'l') { const rs = await LivechatRooms.findByVisitorIdAndAgentId(visitor, agent).toArray(); return rs.length ? rs : null; }
return null;
} Type guard
const isResolvableType = (t: string): t is 'u' | 'd' | 'l' | 'c' => ['u','d','l','c'].includes(t);
Try / catch
try { await auditGetMessagesMethod(userId, params); } catch (e) {
if (e instanceof Meteor.Error && e.reason === `Room doesn't exist`) {
// inform operator no matching room; offer to broaden criteria
} else throw e;
} Prevention
- Validate rid existence (and ABAC exclusion) before auditing.
- For type 'd', confirm usernames share a DM; for 'l', confirm visitor/agent pairing has rooms.
When it happens
Trigger: An audit query for a specific rid that does not exist or that carries abacAttributes (excluded by the query); type 'd' with usernames that share no direct room (findDirectRoomContainingAllUsernames returns null); type 'l' with a visitor/agent pair that has no matching LivechatRooms.
Common situations: Client passes a deleted room id; a DM query where the listed usernames never had a direct conversation; an omnichannel audit with a visitor/agent pair from different departments; ABAC-protected rooms being filtered out.
Related errors
- Not allowed
- There must be a parent room to create a discussion.
- User not subscribed to room
- roomId was not provided.
- Room not found
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/cbaed3c6031e6edd.
Report an issue: GitHub.