Dokploy/dokploy · error · TRPCError

FORBIDDEN

FORBIDDEN

Error message

Valid enterprise license required

What it means

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.

Source

Thrown at apps/dokploy/server/api/trpc.ts:230

 * Requires admin/owner role AND enterprise enabled with a license key in DB.
 * Does NOT call the license server on every request; full validation (haveValidLicenseKey)
 * is used in the UI gate and when activating/validating keys.
 */
export const enterpriseProcedure = t.procedure.use(async ({ ctx, next }) => {
	if (
		!ctx.session ||
		!ctx.user ||
		(ctx.user.role !== "owner" && ctx.user.role !== "admin")
	) {
		throw new TRPCError({ code: "UNAUTHORIZED" });
	}

	const hasValidLicenseResult = await hasValidLicense(
		ctx.session.activeOrganizationId,
	);

	if (!hasValidLicenseResult) {
		throw new TRPCError({
			code: "FORBIDDEN",
			message: "Valid enterprise license required",
		});
	}

	return next({
		ctx: {
			session: ctx.session,
			user: ctx.user,
		},
	});
});

/**
 * Permission-checked procedure factory.
 *
 * Verifies the caller has the required resource+action permission before the
 * handler runs. Works for all role types:

View on GitHub (pinned to 546686ea35)

Solutions

  1. Activate or renew a valid enterprise license for the active organization
  2. Verify the license key is correctly stored for the organization in settings
  3. Check server logs for license validation failures (network errors to the license server)
  4. If the feature is not needed, avoid the enterprise endpoint
Defensive patterns

Strategy: validation

Validate before calling

const license = await getOrganizationLicense(orgId);
if (!license?.valid) throw new Error('Enterprise license required — activate one in settings');

Type guard

const hasLicense = (l: { valid: boolean } | null | undefined): l is { valid: true } => !!l?.valid;

Try / catch

catch (e) { if (e instanceof TRPCError && e.code === 'FORBIDDEN' && e.message.includes('license')) showUpgradePrompt(); throw e; }

Prevention

When it happens

Trigger: Invoking an enterpriseProcedure endpoint when the organization has no license record, an expired license, or a license that failed validation against the license server.

Common situations: 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.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/556147e6fd17c7e7. Report an issue: GitHub.