{"record":{"id":"7f117fae27ca041a","repo":"RocketChat/Rocket.Chat","slug":"invalid-license","errorCode":"invalid-license","errorMessage":"invalid-license","messagePattern":"invalid-license","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/lib/license/canEnableApp.ts","lineNumber":43,"sourceCode":"\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);\n","sourceCodeStart":25,"sourceCodeEnd":51,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/lib/license/canEnableApp.ts#L25-L51","documentation":"Thrown by _canEnableApp after the marketplace branch passes shouldPreventAction('marketplaceApps'), when app.marketplaceInfo[0].isEnterpriseOnly is true and License.hasValidLicense() is false. Plain Error code 'invalid-license'. It only triggers for apps explicitly flagged enterprise-only.","triggerScenarios":"Enabling an enterprise-only marketplace app on a server with no valid license (expired, missing, or invalid); license lapsed after an enterprise-only app was already installed but is being re-enabled.","commonSituations":"Trial/expired license; license validation failing due to offline server / clock skew; reinstalling an enterprise-only app after the license expired.","solutions":["Apply a valid enterprise license and retry.","Resolve whatever invalidates the license (clock sync, connectivity to the license service, renewal).","Install a non-enterprise alternative app if one exists."],"exampleFix":"// before\nawait canEnableApp(app); // isEnterpriseOnly + no valid license -> throws\n\n// after\nif (marketplaceInfo?.isEnterpriseOnly && !License.hasValidLicense()) {\n  return informAdmin('Apply a valid enterprise license to enable this app');\n}","handlingStrategy":"validation","validationCode":"async function canEnableEnterpriseApp(app: IAppStorageItem): Promise<boolean> {\n  const mi = app.marketplaceInfo?.[0];\n  return !mi?.isEnterpriseOnly || License.hasValidLicense();\n}","typeGuard":"const isEnterpriseOnly = (app: IAppStorageItem): boolean =>\n  Boolean(app.marketplaceInfo?.[0]?.isEnterpriseOnly);","tryCatchPattern":"try { await canEnableApp(app); } catch (e) {\n  if (e instanceof Error && e.message === 'invalid-license') { /* apply/renew enterprise license, then retry */ } else throw e;\n}","preventionTips":["Check License.hasValidLicense() before enabling enterprise-only apps.","Monitor license expiry and warn admins before lapse.","Sync server clock to avoid false invalid-license results."],"tags":["apps-engine","license","marketplace","enterprise"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}