RocketChat/Rocket.Chat · error · Error
Room not found
Error message
Room not found
What it means
getRoom() throws 'Room not found' when Rooms.state.get(rid) returns undefined — the room record is not present in the local reactive Rooms store. Like the other strict getters in this factory it has no server fallback; it only reflects the client's synced room cache.
Solutions
- Use findRoom and handle undefined (show loading until rooms sync).
- Verify the rid source (route param, notification payload) and that the room exists on the server via /v1/rooms.info.
- Await the initial rooms/subscriptions load before invoking strict getters.
Example fix
// before
const room = await chat.getRoom();
// after
const room = await chat.findRoom();
if (!room) {
// rooms still syncing or rid invalid
return;
} Defensive patterns
Strategy: validation
Validate before calling
const room = await chat.findRoom();
if (!room) {
// rooms still syncing or rid invalid — show loading / bail
return;
} Prevention
- Await the initial rooms/subscriptions sync before strict room getters.
- Validate rid sources (routes, notifications) against the server when in doubt.
- Use findRoom in UI paths; keep getRoom for guaranteed-loaded contexts.
When it happens
Trigger: Calling getRoom before the user's rooms/subscriptions have finished syncing on login, with a mistyped or foreign rid, or for a room the client never loaded (e.g. referenced only through a message from another context).
Common situations: Deep-linking straight into a room URL before the initial subscription load completes; handling a notification for a room the client has not subscribed to; rid taken from a message of a public room the user never opened.
Related errors
- Subscription not found
- Discussion not found
- error-invalid-room
- error-invalid-subscription
- error-invalid-subscription
AI-assisted analysis of RocketChat/Rocket.Chat@2f18297792 (2026-08-18).
Data as JSON: /api/errors/5e9366e1f8921ff8.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/client/lib/chats/data.ts:268
const drafts = new Map<IMessage['_id'] | undefined, string>();
const getDraft = async (mid: IMessage['_id'] | undefined): Promise<string | undefined> => drafts.get(mid);
const discardDraft = async (mid: IMessage['_id'] | undefined): Promise<void> => {
drafts.delete(mid);
};
const saveDraft = async (mid: IMessage['_id'] | undefined, draft: string): Promise<void> => {
drafts.set(mid, draft);
};
const findRoom = async (): Promise<IRoom | undefined> => Rooms.state.get(rid);
const getRoom = async (): Promise<IRoom> => {
const room = await findRoom();
if (!room) {
throw new Error('Room not found');
}
return room;
};
const isSubscribedToRoom = async (): Promise<boolean> => !!Subscriptions.state.find((record) => record.rid === rid);
const joinRoom = async (): Promise<void> => {
await sdk.rest.post('/v1/rooms.join', { roomId: rid });
};
const findDiscussionByID = async (drid: IRoom['_id']): Promise<IRoom | undefined> =>
Rooms.state.find((record) => Boolean(record._id === drid && record.prid));
const getDiscussionByID = async (drid: IRoom['_id']): Promise<IRoom> => {
const discussion = await findDiscussionByID(drid);
if (!discussion) {View on GitHub (pinned to 2f18297792)