RocketChat/Rocket.Chat · error

Room not found

Error message

Room not found

What it means

Thrown by the useGoToRoom client hook when a room id is not in the local Subscriptions store and the fallback GET /v1/rooms.info call either succeeds with an empty body or returns no `room` field. It means the id does not correspond to any room the server will disclose to the current user. The surrounding catch converts it into an error toast, so the user just sees the failure message.

Solutions

  1. Verify the rid actually exists via GET /v1/rooms.info?roomId=... with the same user token and inspect the response.
  2. If the room was deleted or the user was removed, stop navigating and show an inline 'room unavailable' state instead of calling the hook.
  3. Clear stale ids from persisted state (unread bars, search history) when rooms.info comes back empty rather than retrying.
  4. If the room should exist, check that the authenticated user has at least viewer membership or that the room is public.

Example fix

// before
await goToRoom(rid); // toast: Room not found

// after
const { room } = await getEndpoint('GET', '/v1/rooms.info')({ roomId: rid });
if (!room) {
	showInlineMessage('This room is no longer available');
	return;
}
await goToRoom(rid);
Defensive patterns

Strategy: try-catch

Validate before calling

const roomExists = async (rid: string): Promise<boolean> => {
	const { room } = await getEndpoint('GET', '/v1/rooms.info')({ roomId: rid }).catch(() => ({ room: undefined }));
	return Boolean(room?._id);
};

Type guard

const isRoomMissing = (error: unknown): boolean =>
	Boolean(error && typeof error === 'object' && 'message' in error && (error as Error).message.includes('Room not found'));

Try / catch

try {
	await goToRoom(rid);
} catch (error) {
	if (isRoomMissing(error)) {
		// terminal: room id unknown to server, do not retry
		showInlineState('room-unavailable');
		return;
	}
	dispatchToastMessage({ type: 'error', message: error }); // network/auth errors surface as toast
}

Prevention

When it happens

Trigger: Calling goToRoom(roomId) with a deleted room id, an id from a stale link/notification for a room the user was removed from, a mistyped/foreign rid, or when rooms.info returns success without a room payload. Also fires when the user has no subscription and lacks permission to fetch the room's info.

Common situations: Clicking a permalink or mention to a room deleted during a retention cleanup; opening a room id persisted in localStorage from a previous session after the user lost access; passing a channel id where a message id was expected.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/273ca7ac31bf4d3b. Report an issue: GitHub.

Appendix: source

Thrown at apps/meteor/client/views/room/hooks/useGoToRoom.ts:32

	const router = useRouter();
	const getRoomInfo = useEndpoint('GET', '/v1/rooms.info');
	const dispatchToastMessage = useToastMessageDispatch();

	// TODO: remove params recycling
	return useStableCallback(async (roomId: IRoom['_id'], options?: GoToRoomByIdOptions) => {
		if (!roomId) return;

		const subscription: ISubscription | undefined = Subscriptions.state.find((record) => record.rid === roomId);

		if (subscription) {
			roomCoordinator.openRouteLink(subscription.t, subscription, router.getSearchParameters(), options);
			return;
		}

		try {
			const { room } = await getRoomInfo({ roomId });
			if (!room) {
				throw new Error('Room not found');
			}
			roomCoordinator.openRouteLink(room.t, { rid: room._id, ...room }, router.getSearchParameters(), options);
		} catch (error) {
			dispatchToastMessage({ type: 'error', message: error });
		}
	});
};

View on GitHub (pinned to b2c16d5842)