{"record":{"id":"edd8f5ec8d0b4b91","repo":"RocketChat/Rocket.Chat","slug":"error-app-prevented-edd8f5","errorCode":"error-app-prevented","errorMessage":"error.message","messagePattern":"error\\.message","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/rooms/createDirectRoom.ts","lineNumber":108,"sourceCode":"\t\tt: 'd',\n\t\tusernames,\n\t\tusersCount: members.length,\n\t\tmsgs: 0,\n\t\tts: new Date(),\n\t\tuids,\n\t\t...roomExtraData,\n\t\t...(isReadOnlyForDeactivatedMember && { ro: true, reactWhenReadOnly: false }),\n\t};\n\n\tif (isNewRoom) {\n\t\tconst tmpRoom: { _USERNAMES?: (string | undefined)[] } & typeof roomInfo = {\n\t\t\t...roomInfo,\n\t\t\t_USERNAMES: usernames,\n\t\t};\n\n\t\tconst prevent = await Apps.self?.triggerEvent(AppEvents.IPreRoomCreatePrevent, tmpRoom).catch((error) => {\n\t\t\tif (error.name === AppsEngineException.name) {\n\t\t\t\tthrow new Meteor.Error('error-app-prevented', error.message);\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t});\n\n\t\tif (prevent) {\n\t\t\tthrow new Meteor.Error('error-app-prevented', 'A Rocket.Chat App prevented the room creation.');\n\t\t}\n\n\t\tconst result = await Apps.self?.triggerEvent(\n\t\t\tAppEvents.IPreRoomCreateModify,\n\t\t\tawait Apps.self?.triggerEvent(AppEvents.IPreRoomCreateExtend, tmpRoom),\n\t\t);\n\n\t\tif (typeof result === 'object') {\n\t\t\tObject.assign(roomInfo, result);\n\t\t}\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/2a7de457074cbb4d4373fbd9a4e5bea292c9c764/apps/meteor/server/lib/rooms/createDirectRoom.ts#L90-L126","documentation":"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.","triggerScenarios":"An app vetoing room creation (naming policy, quota, compliance apps) throws inside the IPreRoomCreatePrevent event while a direct-message room is being created.","commonSituations":"Apps enforcing naming conventions or creation quotas that also apply to DMs; app bugs throwing instead of returning true.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await createDirectRoom(members);\n} catch (error: any) {\n  if (error?.error === 'error-app-prevented') {\n    // error.reason is the app's explanation from IPreRoomCreatePrevent\n  }\n}","preventionTips":["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."],"tags":["apps-engine","apps","direct-messages","event-veto"],"backgroundTag":"app-event-prevented","analyzedSha":"2a7de457074cbb4d4373fbd9a4e5bea292c9c764","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}