mastra-ai/mastra · critical · Error

[mastra/auth-ee] ${featureList} ${configuredFeatures.length

Error message

[mastra/auth-ee] ${featureList} ${configuredFeatures.length === 1 ? 'is' : 'are'} configured but no valid EE license was found.
${featureList} ${configuredFeatures.length === 1 ? 'requires' : 'require'} a Mastra Enterprise License for production use.
Set the MASTRA_EE_LICENSE environment variable with your license key.
Learn more: https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE

What it means

Startup/ configuration error from the server adapter's EE gate: one or more enterprise features are configured (featureList), but isEEEnabled() from @mastra/core/auth/ee reports no valid EE license (typically no/invalid MASTRA_EE_LICENSE). Mastra blocks boot rather than silently running licensed features without a license.

Source

Thrown at packages/server/src/server/server-adapter/index.ts:852

   * Validate that EE features have a valid license in production.
   * Throws if RBAC or FGA is configured without a valid license outside dev/test environments.
   */
  async validateEELicense(): Promise<void> {
    const serverConfig = this.mastra.getServer();
    const studioConfig = this.mastra.getStudio?.();
    // Check both server and studio configs for EE features
    const configuredFeatures = [
      serverConfig?.rbac || studioConfig?.rbac ? 'RBAC' : null,
      serverConfig?.fga || studioConfig?.fga ? 'FGA' : null,
    ].filter((feature): feature is string => feature !== null);

    if (configuredFeatures.length === 0) return;

    try {
      const { isEEEnabled } = await import('@mastra/core/auth/ee');
      if (!isEEEnabled()) {
        const featureList = configuredFeatures.join(' and ');
        throw new Error(
          `[mastra/auth-ee] ${featureList} ${configuredFeatures.length === 1 ? 'is' : 'are'} configured but no valid EE license was found.\n` +
            `${featureList} ${configuredFeatures.length === 1 ? 'requires' : 'require'} a Mastra Enterprise License for production use.\n` +
            'Set the MASTRA_EE_LICENSE environment variable with your license key.\n' +
            'Learn more: https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE',
        );
      }
    } catch (err) {
      if (err instanceof Error && err.message.startsWith('[mastra/auth-ee]')) {
        throw err;
      }
      // @mastra/core/auth/ee module not available; EE authorization cannot function.
      throw new Error(
        `[mastra/auth-ee] ${configuredFeatures.join(' and ')} ${configuredFeatures.length === 1 ? 'is' : 'are'} configured but the EE module (@mastra/core/auth/ee) could not be loaded.\n` +
          'Ensure @mastra/core is updated to a version that includes EE support.',
      );
    }
  }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Set the MASTRA_EE_LICENSE environment variable to a valid license key in the environment where the server runs.
  2. Verify the env var actually reaches the process (docker-compose env, k8s secret, .env loaded before boot).
  3. Check license validity/expiry with the license issuer and renew if expired.
  4. If you don't need the feature, remove the EE feature configuration so the gate passes.

Example fix

// before
new MastraServer({ mastra, ee: { authorization: {...} } }); // no MASTRA_EE_LICENSE

// after
// .env
// MASTRA_EE_LICENSE=eyJhbGciOi...
new MastraServer({ mastra, ee: { authorization: {...} } });
Defensive patterns

Strategy: validation

Validate before calling

const license = process.env.MASTRA_EE_LICENSE;
if (!license || license.trim() === '') {
  throw new Error('EE features are configured but MASTRA_EE_LICENSE is not set; set a valid license key before booting the server');
}

Type guard

function hasEeLicense(env: NodeJS.ProcessEnv): env is NodeJS.ProcessEnv & { MASTRA_EE_LICENSE: string } {
  return typeof env.MASTRA_EE_LICENSE === 'string' && env.MASTRA_EE_LICENSE.trim().length > 0;
}

Try / catch

try {
  await startServer(mastra);
} catch (e) {
  if (e instanceof Error && e.message.includes('no valid EE license was found')) {
    console.error('EE license missing/invalid: set MASTRA_EE_LICENSE or remove EE feature config.');
    process.exitCode = 1;
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Configuring any EE feature (checked in server-adapter, e.g. EE authorization options) while isEEEnabled() returns false because MASTRA_EE_LICENSE is unset, expired, malformed, or not visible to the process environment.

Common situations: Deploying with EE auth config copied from another project without the license env var; license key present locally but missing in the deployment's environment variables; expired trial/enterprise license; running features in dev that require enterprise licensing.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/65fa51a679d02e19. Report an issue: GitHub.