RocketChat/Rocket.Chat · error · Meteor.Error

error-app-prevented

error-app-prevented

Error message

error.message

What it means

Meteor.Error('error-app-prevented') thrown when an installed Rocket.Chat App's IPreRoomUserJoined event handler throws an AppsEngineException while a user accepts a room invite. The app's own message becomes the error reason; non-app errors are rethrown untouched.

Source

Thrown at apps/meteor/server/lib/rooms/acceptRoomInvite.ts:38

export const performAcceptRoomInvite = async (
	room: IRoom,
	subscription: ISubscription,
	user: IUser & { username: string },
): Promise<void> => {
	if (subscription.status !== 'INVITED' || !subscription.inviter) {
		throw new Meteor.Error('error-not-invited', `User was not invited to this room ${subscription.status}`);
	}
	const inviter = await Users.findOneById(subscription.inviter._id);

	await callbacks.run('beforeJoinRoom', user, room);

	await callbacks.run('beforeAddedToRoom', { user, inviter }, room);

	try {
		await Apps.self?.triggerEvent(AppEvents.IPreRoomUserJoined, room, user, inviter);
	} catch (error: any) {
		if (error.name === AppsEngineException.name) {
			throw new Meteor.Error('error-app-prevented', error.message);
		}

		throw error;
	}

	await Subscriptions.acceptInvitationById(subscription._id);

	void notifyOnSubscriptionChangedById(subscription._id, 'updated');

	await Message.saveSystemMessage('uj', room._id, user.username, user);

	if (room.t === 'c' || room.t === 'p') {
		process.nextTick(async () => {
			// Add a new event, with an optional inviter
			await callbacks.run('afterAddedToRoom', { user, inviter }, room);

			// Keep the current event
			await callbacks.run('afterJoinRoom', user, room);

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Read the error message - it is the app's explanation for the veto.
  2. Adjust the app's rules or configuration for this room/user.
  3. Disable or update the app if the block is unintended.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await performAcceptRoomInvite(room, subscription, user);
} catch (error: any) {
  if (error?.error === 'error-app-prevented') {
    // error.reason is the app's veto message: surface it to the user
  }
}

Prevention

When it happens

Trigger: An app implementing IPreRoomUserJoined (join-policy, approval, compliance apps) vetoes the join during acceptRoomInvite.

Common situations: Apps enforcing approval workflows or external checks on joins; app misconfiguration blocking everyone; app updates with stricter defaults.

Related errors


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