RocketChat/Rocket.Chat · warning · NotSubscribedToRoomError

not-subscribed-room

not-subscribed-room

Error message

Not subscribed to this room

What it means

Thrown as NotSubscribedToRoomError ('not-subscribed-room') when a logged-in user has no subscription to a public room, lacks the preview-c-room permission, and isPublicRoom(room) is true. It gates access so unsubscribed users cannot read a public room's contents without preview rights.

Source

Thrown at apps/meteor/client/views/room/hooks/useOpenRoom.ts:135

			const room = Rooms.state.get(roomData._id);

			if (!room) {
				throw new TypeError('room is undefined');
			}

			const sub = Subscriptions.state.find((record) => record.t === type && (record.rid === reference || record.name === reference));

			if (reference !== undefined && room._id !== reference && type === 'd') {
				// Redirect old url using username to rid
				LegacyRoomManager.close(type + reference);
				directRoute.push({ rid: room._id }, (prev) => prev);
				throw new OldUrlRoomError(undefined, { rid: room._id });
			}

			// if user doesn't exist at this point, anonymous read is enabled, otherwise an error would have been thrown
			if (user && !sub && !hasPreviewPermission && isPublicRoom(room)) {
				throw new NotSubscribedToRoomError(undefined, { rid: room._id });
			}

			LegacyRoomManager.open({ typeName: type + reference, rid: room._id });

			if (room._id === RoomManager.opened) {
				return { rid: room._id };
			}

			// update user's room subscription

			if (!!user?._id && sub && !sub.open) {
				await openRoom.mutateAsync({ roomId: room._id, userId: user._id });
			}

			return { rid: room._id };
		},
		retry: (failureCount, error) => {
			const unrecoverableErrors = [RoomNotFoundError, OldUrlRoomError, NotAuthorizedError, NotSubscribedToRoomError];

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Grant the user (or their role) the preview-c-room permission if preview is intended.
  2. Offer a join/subscribe action in the resulting no-access UI so the user can opt in.
  3. If access is intentional, subscribe the user to the room.
Defensive patterns

Strategy: validation

Validate before calling

// Check preview permission client-side before relying on the error path.
const canPreview = usePermission('preview-c-room');
if (user && !sub && !canPreview && isPublicRoom(room)) {
  // show join/subscribe CTA instead of letting the query throw
}

Type guard

const isNotSubscribedError = (e: unknown): boolean => e instanceof NotSubscribedToRoomError;

Try / catch

if (error instanceof NotSubscribedToRoomError) {
  return <JoinRoomScreen rid={error.details?.rid} />;
}

Prevention

When it happens

Trigger: Authenticated user opens a public channel they never joined, with no preview permission and no subscription record; admin revoked preview-c-room role-wide.

Common situations: User follows a link to a public channel they haven't joined; permission role changed to remove preview-c-room; guest user with limited permissions.

Related errors


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