RocketChat/Rocket.Chat · error · Meteor.Error

error-no-suggested-key-available

error-no-suggested-key-available

Error message

No suggested key available

What it means

The user is subscribed to the room, but the subscription's E2ESuggestedKey is null, empty, or whitespace-only, so there is no suggested key to accept or reject. Accepting a key clears/consumes the suggestion, so repeat or late actions hit this guard.

Source

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

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);
		}
	}

	if (handle === 'reject') {
		const { modifiedCount } = await Rooms.addUserIdToE2EEQueueByRoomIds([sub.rid], userId);
		if (modifiedCount) {
			void notifyOnRoomChangedById(sub.rid);
		}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Reload the room/subscription — if the key was already accepted, the action is unnecessary
  2. If a new key is expected, have a member holding the current room key re-trigger key distribution, then retry
Defensive patterns

Strategy: validation

Validate before calling

const sub = await Subscriptions.findOneByRoomIdAndUserId(rid, userId);
const hasSuggestedKey = Boolean(String(sub?.E2ESuggestedKey ?? '').trim());
// only show the accept/reject prompt when hasSuggestedKey is true

Prevention

When it happens

Trigger: Calling accept/reject after the suggested key was already consumed by a prior accept (which writes the group key and removes the user from the E2EE queue), or when the key was never distributed to this subscription.

Common situations: Double-submitting the suggested-key dialog; another session or device already accepted the key; race between key distribution and the user acting.

Related errors


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