{"record":{"id":"556147e6fd17c7e7","repo":"Dokploy/dokploy","slug":"forbidden-556147","errorCode":"FORBIDDEN","errorMessage":"Valid enterprise license required","messagePattern":"Valid enterprise license required","errorType":"error_code","errorClass":"TRPCError","httpStatus":403,"severity":"error","filePath":"apps/dokploy/server/api/trpc.ts","lineNumber":230,"sourceCode":" * Requires admin/owner role AND enterprise enabled with a license key in DB.\n * Does NOT call the license server on every request; full validation (haveValidLicenseKey)\n * is used in the UI gate and when activating/validating keys.\n */\nexport const enterpriseProcedure = t.procedure.use(async ({ ctx, next }) => {\n\tif (\n\t\t!ctx.session ||\n\t\t!ctx.user ||\n\t\t(ctx.user.role !== \"owner\" && ctx.user.role !== \"admin\")\n\t) {\n\t\tthrow new TRPCError({ code: \"UNAUTHORIZED\" });\n\t}\n\n\tconst hasValidLicenseResult = await hasValidLicense(\n\t\tctx.session.activeOrganizationId,\n\t);\n\n\tif (!hasValidLicenseResult) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"FORBIDDEN\",\n\t\t\tmessage: \"Valid enterprise license required\",\n\t\t});\n\t}\n\n\treturn next({\n\t\tctx: {\n\t\t\tsession: ctx.session,\n\t\t\tuser: ctx.user,\n\t\t},\n\t});\n});\n\n/**\n * Permission-checked procedure factory.\n *\n * Verifies the caller has the required resource+action permission before the\n * handler runs. Works for all role types:","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/trpc.ts#L212-L248","documentation":"Thrown by enterpriseProcedure after the role check passes but hasValidLicense(activeOrganizationId) returns false. It marks enterprise-only functionality that the organization has not activated or whose license is invalid/expired.","triggerScenarios":"Invoking an enterpriseProcedure endpoint when the organization has no license record, an expired license, or a license that failed validation against the license server.","commonSituations":"Trial license expired; license deactivated or removed server-side; organization created before license activation; license server validation failing; self-hosted community edition hitting enterprise routes.","solutions":["Activate or renew a valid enterprise license for the active organization","Verify the license key is correctly stored for the organization in settings","Check server logs for license validation failures (network errors to the license server)","If the feature is not needed, avoid the enterprise endpoint"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const license = await getOrganizationLicense(orgId);\nif (!license?.valid) throw new Error('Enterprise license required — activate one in settings');","typeGuard":"const hasLicense = (l: { valid: boolean } | null | undefined): l is { valid: true } => !!l?.valid;","tryCatchPattern":"catch (e) { if (e instanceof TRPCError && e.code === 'FORBIDDEN' && e.message.includes('license')) showUpgradePrompt(); throw e; }","preventionTips":["Validate license before enabling enterprise features in UI","Monitor license expiry and notify admins ahead of renewal"],"tags":["licensing","enterprise","trpc","forbidden"],"backgroundTag":"license-invalid-or-expired","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}