{"record":{"id":"9a5a2823924ca072","repo":"OtterMind/Chat2DB","slug":"license-flow-is-disabled-in-community-mode","errorCode":null,"errorMessage":"License flow is disabled in community mode","messagePattern":"License flow is disabled in community mode","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"chat2db-community-client/src/community-stubs/service/license.ts","lineNumber":4,"sourceCode":"const licenseService = {\n  startTrial: async () => undefined,\n  validLicense: async () => {\n    throw new Error('License flow is disabled in community mode');\n  },\n  removeLicense: async () => undefined,\n  sendEmailLicense: async () => undefined,\n  checkPasscode: async () => undefined,\n  getDeviceId: async () => '',\n  activateCer: async () => undefined,\n  getLicenseList: async () => [],\n  generateCertificate: async () => '',\n  listCertificate: async () => [],\n  deactivateOnline: async () => undefined,\n};\n\nexport default licenseService;\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-client/src/community-stubs/service/license.ts#L1-L18","documentation":"This error is thrown by the community-mode license stub when validLicense() is called. The Community build (UMI_ENV=community / __RUNTIME_ENV__==='community') ships a no-op license service where every method returns a safe default except validLicense, which deliberately throws to signal that the licensing subsystem is intentionally absent. It exists because the Community edition has no paid license flow, so any attempt to validate a license must fail loudly rather than silently return true.","triggerScenarios":"Calling licenseService.validLicense() in a Community build. This happens when UI components gated behind an isEnterprise/isLicensed check render and invoke the license check, or when a persisted/legacy code path calls validLicense unconditionally without checking runtime edition.","commonSituations":"Running the frontend with UMI_ENV=community but a component still calls validLicense (e.g., a feature flag not fully gated by edition). Migrating from Enterprise to Community without removing a license-check call site. A shared component used across editions that unconditionally probes license validity.","solutions":["Guard the call site with an edition check (e.g., __RUNTIME_ENV__ !== 'community') before invoking validLicense.","Wrap the call in try/catch and treat the error as 'no valid license' to fall back to Community-appropriate UI.","Remove or disable the UI component that triggers validLicense in Community builds via conditional rendering."],"exampleFix":"// before\nconst isValid = await licenseService.validLicense();\n\n// after\nlet isValid = false;\ntry {\n  isValid = await licenseService.validLicense();\n} catch {\n  // Community mode has no license; treat as unlicensed\n}","handlingStrategy":"try-catch","validationCode":"const isLicenseCheckAvailable = __RUNTIME_ENV__ !== 'community';\n// Only call validLicense when isLicenseCheckAvailable is true","typeGuard":"function canCheckLicense(): boolean {\n  return typeof __RUNTIME_ENV__ === 'string' && __RUNTIME_ENV__ !== 'community';\n}","tryCatchPattern":"let valid = false;\ntry {\n  valid = await licenseService.validLicense();\n} catch (e) {\n  if (e instanceof Error && /disabled in community mode/.test(e.message)) {\n    valid = false;\n  } else {\n    throw e;\n  }\n}","preventionTips":["Gate every licenseService.validLicense call behind an edition check.","Use a feature-flag/edition context provider to centralize edition logic.","Add a unit test asserting validLicense is never called in Community builds."],"tags":["community-mode","license","feature-flag","frontend"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}