{"record":{"id":"89c8d7d33a51cf0d","repo":"RocketChat/Rocket.Chat","slug":"license-prevented","errorCode":"license-prevented","errorMessage":"license-prevented","messagePattern":"license-prevented","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/lib/license/canEnableApp.ts","lineNumber":32,"sourceCode":"\tif (!(await Apps.isInitialized())) {\n\t\tthrow new Error('apps-engine-not-initialized');\n\t}\n\n\t// Migrated apps were installed before the validation was implemented\n\t// so they're always allowed to be enabled\n\tif (app.migrated) {\n\t\treturn;\n\t}\n\n\tif (app.info.addon && !License.hasModule(app.info.addon as LicenseModule)) {\n\t\tthrow new Error('app-addon-not-valid');\n\t}\n\n\tconst source = getInstallationSourceFromAppStorageItem(app);\n\tswitch (source) {\n\t\tcase 'private':\n\t\t\tif (await License.shouldPreventAction('privateApps')) {\n\t\t\t\tthrow new Error('license-prevented');\n\t\t\t}\n\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (await License.shouldPreventAction('marketplaceApps')) {\n\t\t\t\tthrow new Error('license-prevented');\n\t\t\t}\n\n\t\t\tconst marketplaceInfo = app.marketplaceInfo?.[0];\n\t\t\tif (marketplaceInfo?.isEnterpriseOnly && !License.hasValidLicense()) {\n\t\t\t\tthrow new Error('invalid-license');\n\t\t\t}\n\n\t\t\tbreak;\n\t}\n};\n\nexport const canEnableApp = async (app: IAppStorageItem): Promise<void> => _canEnableApp({ Apps, License }, app);","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/lib/license/canEnableApp.ts#L14-L50","documentation":"Thrown by _canEnableApp when the app's installation source resolves to 'private' and License.shouldPreventAction('privateApps') is true — the license does not permit private (non-marketplace) apps. Plain Error code 'license-prevented'. Same code as error 235 but distinct branch (private vs default/marketplace).","triggerScenarios":"Enabling a privately-installed app (uploaded directly, not from marketplace) on a license whose 'privateApps' entitlement prevents it; trial license that only allows marketplace apps.","commonSituations":"Customer uploaded a custom internal app but their license tier restricts to marketplace apps; license downgrade after private apps were installed.","solutions":["Upgrade to a license that allows private apps.","Install an equivalent app from the marketplace instead, if one exists.","Disable the private-app restriction in the license terms (requires license change)."],"exampleFix":"// before\nconst source = getInstallationSourceFromAppStorageItem(app); // 'private'\nawait canEnableApp(app); // throws license-prevented\n\n// after: gate the UI/API on entitlement\nif (await License.shouldPreventAction('privateApps')) {\n  return informAdmin('This license does not allow private apps');\n}","handlingStrategy":"validation","validationCode":"async function canEnablePrivateApp(): Promise<boolean> {\n  return !(await License.shouldPreventAction('privateApps'));\n}","typeGuard":"const isPrivateSource = (app: IAppStorageItem): boolean =>\n  getInstallationSourceFromAppStorageItem(app) === 'private';","tryCatchPattern":"try { await canEnableApp(app); } catch (e) {\n  if (e instanceof Error && e.message === 'license-prevented' && isPrivateSource(app)) { /* upgrade license for private apps */ } else throw e;\n}","preventionTips":["Surface the privateApps entitlement in the admin apps page.","Prefer marketplace equivalents when the license blocks private apps."],"tags":["apps-engine","license","private-apps","enterprise"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}