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 by createDirectRoom when an app's IPreRoomCreatePrevent handler throws an AppsEngineException. The app's message becomes the error reason; other errors propagate unchanged.
Source
Thrown at apps/meteor/server/lib/rooms/createDirectRoom.ts:108
t: 'd',
usernames,
usersCount: members.length,
msgs: 0,
ts: new Date(),
uids,
...roomExtraData,
...(isReadOnlyForDeactivatedMember && { ro: true, reactWhenReadOnly: false }),
};
if (isNewRoom) {
const tmpRoom: { _USERNAMES?: (string | undefined)[] } & typeof roomInfo = {
...roomInfo,
_USERNAMES: usernames,
};
const prevent = await Apps.self?.triggerEvent(AppEvents.IPreRoomCreatePrevent, tmpRoom).catch((error) => {
if (error.name === AppsEngineException.name) {
throw new Meteor.Error('error-app-prevented', error.message);
}
throw error;
});
if (prevent) {
throw new Meteor.Error('error-app-prevented', 'A Rocket.Chat App prevented the room creation.');
}
const result = await Apps.self?.triggerEvent(
AppEvents.IPreRoomCreateModify,
await Apps.self?.triggerEvent(AppEvents.IPreRoomCreateExtend, tmpRoom),
);
if (typeof result === 'object') {
Object.assign(roomInfo, result);
}
View on GitHub (pinned to 2a7de45707)
Solutions
- Read the app's message embedded in the error reason.
- Adjust the app's policy so legitimate DM creation passes.
- Disable or fix the app if it wrongly blocks DM creation.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await createDirectRoom(members);
} catch (error: any) {
if (error?.error === 'error-app-prevented') {
// error.reason is the app's explanation from IPreRoomCreatePrevent
}
} Prevention
- Review apps implementing IPreRoomCreatePrevent when DM creation fails.
- Keep creation policies permissive for DMs unless intentionally restricted.
- Log the app reason to distinguish app vetoes from server errors.
When it happens
Trigger: An app vetoing room creation (naming policy, quota, compliance apps) throws inside the IPreRoomCreatePrevent event while a direct-message room is being created.
Common situations: Apps enforcing naming conventions or creation quotas that also apply to DMs; app bugs throwing instead of returning true.
Related errors
- error-app-prevented
- error-app-prevented
- error-app-prevented-deleting
- The command is not currently disabled: "${cmd}"
- Invalid reaction
AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18).
Data as JSON: /api/errors/edd8f5ec8d0b4b91.
Report an issue: GitHub.