RocketChat/Rocket.Chat · error · Error

Room not found

Error message

Room not found

What it means

Thrown by RealAppsEngineUIHost.getClientRoomInfo when there is no currently opened room — either RoomManager.opened is falsy (no room selected) or Rooms.state.get(...) returns undefined for the opened room id (room not in the reactive store). The apps-engine UI host needs a concrete room to populate IExternalComponentRoomInfo, so it fails fast.

Source

Thrown at apps/meteor/client/apps/RealAppsEngineUIHost.ts:36

		super();

		this._baseURL = baseURI.replace(/\/$/, '');
	}

	private getUserAvatarUrl(username: string) {
		const avatarUrl = getUserAvatarURL(username)!;

		if (!avatarUrl.startsWith('http') && !avatarUrl.startsWith('data')) {
			return `${this._baseURL}${avatarUrl}`;
		}

		return avatarUrl;
	}

	async getClientRoomInfo(): Promise<IExternalComponentRoomInfo> {
		const room = RoomManager.opened ? Rooms.state.get(RoomManager.opened) : undefined;
		if (!room) {
			throw new Error('Room not found');
		}
		const { name: slugifiedName, _id: id } = room;

		let cachedMembers: IExternalComponentUserInfo[] = [];
		try {
			const { members } = await sdk.rest.get('/v1/groups.members', { roomId: id });

			cachedMembers = members.map(
				({ _id, username }): IExternalComponentUserInfo => ({
					id: _id,
					username: username!,
					avatarUrl: this.getUserAvatarUrl(username!),
				}),
			);
		} catch (error) {
			console.warn(error);
		}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Ensure getClientRoomInfo is only called when a room is actually opened — gate the app view on RoomManager.opened.
  2. If the room was left/removed, navigate the user back to a room before re-initializing the app view.
  3. In tests, seed RoomManager.opened and the Rooms store before mounting the app host.
  4. Handle the error to show a 'select a room' state instead of crashing the app view.
Defensive patterns

Strategy: validation

Validate before calling

const opened = RoomManager.opened;
if (!opened) { throw new Error('Open a room first'); }
const room = Rooms.state.get(opened);
if (!room) { await loadRoom(opened); }

Type guard

function hasOpenedRoom(opened: string | null | undefined): opened is string {
  return typeof opened === 'string' && opened.length > 0;
}

Try / catch

try {
  const info = await host.getClientRoomInfo();
} catch (e) {
  if ((e as Error).message === 'Room not found') {
    navigateToRoomList();
  }
}

Prevention

When it happens

Trigger: An app's UI component calls getClientRoomInfo before any room is opened, after the user navigated away, or when the opened room was evicted from the Rooms store (e.g. cache cleared, room left). RoomManager.opened being null triggers the first condition; a missing store entry triggers the second.

Common situations: App view rendered on a screen with no active room; race during room switching where the app initializes before RoomManager.opened is set; the room was just closed/left and the store was pruned; E2E test opening an app route without a room context.

Related errors


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