{"record":{"id":"eac305c59eaba6b0","repo":"RocketChat/Rocket.Chat","slug":"error-app-prevented-eac305","errorCode":"error-app-prevented","errorMessage":"error-app-prevented","messagePattern":"error-app-prevented","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/omnichannel/QueueManager.ts","lineNumber":366,"sourceCode":"\t\t\tif (!defaultAgent && guest.department && !department) {\n\t\t\t\tthrow new Meteor.Error('no-agent-online', 'Sorry, no online agents');\n\t\t\t}\n\n\t\t\tif (!agent && !guest.department && !(await checkOnlineAgents())) {\n\t\t\t\tthrow new Meteor.Error('no-agent-online', 'Sorry, no online agents');\n\t\t\t}\n\t\t}\n\n\t\tconst insertionRoom = await prepareLivechatRoom(rid, { ...guest, ...(department && { department }) }, roomInfo, {\n\t\t\t...extraData,\n\t\t\t...(Boolean(customFields) && { customFields }),\n\t\t});\n\n\t\ttry {\n\t\t\tawait Apps.self?.triggerEvent(AppEvents.IPreLivechatRoomCreatePrevent, insertionRoom);\n\t\t} catch (error: any) {\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\t// Transactional start of the conversation. This should prevent rooms from being created without inquiries and viceversa.\n\t\t// All the actions that happened inside createLivechatRoom are now outside this transaction\n\t\tconst { room, inquiry } = await this.startConversation(rid, insertionRoom, guest, roomInfo, defaultAgent, message, extraData);\n\n\t\tawait onNewRoom(room);\n\t\tawait Message.saveSystemMessageAndNotifyUser(\n\t\t\t'livechat-started',\n\t\t\trid,\n\t\t\t'',\n\t\t\t{ _id: guest._id, username: guest.username },\n\t\t\t{ groupable: false, token: guest.token },\n\t\t);\n\t\tvoid Apps.self?.triggerEvent(AppEvents.IPostLivechatRoomStarted, room);","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/2a7de457074cbb4d4373fbd9a4e5bea292c9c764/apps/meteor/server/lib/omnichannel/QueueManager.ts#L348-L384","documentation":"Rocket.Chat Apps can subscribe to the IPreLivechatRoomCreatePrevent lifecycle event and veto livechat room creation. When such an App throws an AppsEngineException during QueueManager.requestRoom, the server rethrows it as Meteor.Error('error-app-prevented') carrying the App's own message. The room, its inquiry, and the conversation are never created.","triggerScenarios":"Any installed App whose IPreLivechatRoomCreatePrevent handler calls preventResult()/throws - e.g. a moderation app blocking banned visitors, or a custom policy app rejecting rooms that lack required custom fields - while a livechat room is being created for a guest.","commonSituations":"A marketplace or private app enforcing company policy on new chats; an app update made its validation stricter and now rejects rooms that previously passed; a leftover enabled app silently vetoing all new omnichannel rooms after a process change.","solutions":["Read error.message (or error.reason) - it is the App's own explanation of why creation was prevented","Inspect installed Apps (Administration > Apps), find the one listening on IPreLivechatRoomCreatePrevent, and adjust its configuration or prevent conditions","Disable or uninstall the offending app if the veto is unwanted","Update the app's code to stop preventing this specific scenario"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await QueueManager.requestRoom({ guest, roomInfo });\n} catch (err: any) {\n  if (err?.error === 'error-app-prevented') {\n    // err.message / err.reason carries the App's own explanation\n    logger.warn({ msg: 'Livechat room creation vetoed by app', reason: err.message });\n    return respondForbidden(err.message);\n  }\n  throw err;\n}","preventionTips":["Inventory installed Apps and note which listen on IPreLivechatRoomCreatePrevent","Test room creation in staging after every App install or upgrade to catch new vetoes","Log 'error-app-prevented' occurrences with the App message so policy rejections stay diagnosable"],"tags":["omnichannel","livechat","apps-engine","lifecycle-hooks","meteor-error"],"backgroundTag":"apps-engine-prevented-action","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"}