RocketChat/Rocket.Chat · warning · Error

Room not found

Error message

Room not found

What it means

Thrown inside useGoToRoom when GET /v1/rooms.info succeeds (no HTTP error) but the response body contains no room field. It signals the server returned a 200 with an empty/missing room payload for the given roomId, so the client treats the room as nonexistent. The surrounding try/catch immediately converts it into an error toast via dispatchToastMessage.

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 f9d3ec372b)

Solutions

  1. Validate/refresh the roomId source (notification payload, link) before calling; drop references to known-deleted rooms.
  2. In the catch block, distinguish a missing-room case and navigate the user back to /home or show a 'room unavailable' state instead of only a toast.
  3. If rooms.info consistently returns no room for valid ids, check server logs for the rooms collection / subscription sync state.

Example fix

// before
const { room } = await getRoomInfo({ roomId });
if (!room) {
  throw new Error('Room not found');
}

// after
const { room } = await getRoomInfo({ roomId });
if (!room) {
  dispatchToastMessage({ type: 'error', message: 'Room not found' });
  router.navigate('/home', { replace: true });
  return;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate roomId shape and existence from local cache before the network call.
const cached = Rooms.state.get(roomId);
if (!cached && !/^[A-Za-z0-9]{17}$/.test(roomId)) {
  dispatchToastMessage({ type: 'error', message: 'Invalid room id' });
  return;
}

Type guard

const hasRoom = (res: unknown): res is { room: { _id: string; t: string } } =>
  typeof res === 'object' && res !== null &&
  'room' in res && typeof (res as any).room?._id === 'string';

Try / catch

try {
  const res = await getRoomInfo({ roomId });
  if (!hasRoom(res)) {
    dispatchToastMessage({ type: 'error', message: 'Room not found' });
    router.navigate('/home', { replace: true });
    return;
  }
  roomCoordinator.openRouteLink(res.room.t, { rid: res.room._id, ...res.room }, router.getSearchParameters(), options);
} catch (error) {
  dispatchToastMessage({ type: 'error', message: error });
}

Prevention

When it happens

Trigger: Calling goToRoomById with a roomId that the server cannot resolve (deleted room, stale id from a notification/link); rooms.info returning success:true with room omitted for a room the user lacks permission to view; passing an empty/whitespace roomId that slipped past the early `if (!roomId) return`.

Common situations: User clicks a notification or mention for a room they were just removed from; room was deleted between notification creation and click; cross-workspace shared link where the id does not exist locally.

Related errors


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