RocketChat/Rocket.Chat · error · Meteor.Error

error-subscription-not-found

error-subscription-not-found

Error message

Subscription not found

What it means

Thrown when Subscriptions.findOneByRoomIdAndUserId(rid, userId) returns null: the acting user has no subscription document for that room, so there is no E2E suggested-key context to accept or reject. This check runs immediately after the user validation.

Source

Thrown at apps/meteor/server/lib/e2e/functions/handleSuggestedGroupKey.ts:18

import { Rooms, Subscriptions } from '@rocket.chat/models';
import { Meteor } from 'meteor/meteor';

import { notifyOnSubscriptionChangedById, notifyOnRoomChangedById } from '../../notifyListener';

export async function handleSuggestedGroupKey(
	handle: 'accept' | 'reject',
	rid: string,
	userId: string | null,
	method: string,
): Promise<void> {
	if (!userId) {
		throw new Meteor.Error('error-invalid-user', 'Invalid user', { method });
	}

	const sub = await Subscriptions.findOneByRoomIdAndUserId(rid, userId);
	if (!sub) {
		throw new Meteor.Error('error-subscription-not-found', 'Subscription not found', { method });
	}

	const suggestedKey = String(sub.E2ESuggestedKey ?? '').trim();
	if (!suggestedKey) {
		throw new Meteor.Error('error-no-suggested-key-available', 'No suggested key available', { method });
	}

	if (handle === 'accept') {
		// A merging process can happen here, but we're not doing that for now
		// If a user already has oldRoomKeys, we will ignore the suggested ones
		const oldKeys = sub.oldRoomKeys ? undefined : sub.suggestedOldRoomKeys;
		await Subscriptions.setGroupE2EKeyAndOldRoomKeys(sub._id, suggestedKey, oldKeys);
		const { modifiedCount } = await Rooms.removeUsersFromE2EEQueueByRoomId(sub.rid, [userId]);
		if (modifiedCount) {
			void notifyOnRoomChangedById(sub.rid);
		}
	}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Reload the room list and confirm the user is still a member of the room
  2. If membership is expected, rejoin the room so a subscription exists, then retry the key action
Defensive patterns

Strategy: validation

Validate before calling

const sub = await Subscriptions.findOneByRoomIdAndUserId(rid, userId);
if (!sub) {
  // user is not in the room: hide the accept/reject suggested-key action
}

Prevention

When it happens

Trigger: Accepting or rejecting a suggested group key for a room the user never joined, was removed from, or whose subscription was deleted — or with a mismatched/typo'd rid.

Common situations: Stale client UI still listing a room the user already left; the user was removed while the key dialog was open; room id copied between environments.

Related errors


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