{"record":{"id":"e8d471e07ae9c54c","repo":"mastra-ai/mastra","slug":"mastra-auth-ee-agent-builder-is-configured-but-t","errorCode":null,"errorMessage":"[mastra/auth-ee] Agent Builder is configured but the EE module (@mastra/core/auth/ee) could not be loaded.\nEnsure @mastra/core is updated to a version that includes EE support.","messagePattern":"\\[mastra/auth-ee\\] Agent Builder is configured but the EE module \\(@mastra/core/auth/ee\\) could not be loaded\\.\nEnsure @mastra/core is updated to a version that includes EE support\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/server/src/server/server-adapter/index.ts","lineNumber":894,"sourceCode":"    const editor = this.mastra.getEditor();\n    if (!editor?.hasEnabledBuilderConfig?.()) return;\n\n    try {\n      const { isEEEnabled } = await import('@mastra/core/auth/ee');\n      if (!isEEEnabled()) {\n        throw new Error(\n          '[mastra/auth-ee] Agent Builder is configured but no valid EE license was found.\\n' +\n            'Agent Builder requires a Mastra Enterprise License for production use.\\n' +\n            'Set the MASTRA_EE_LICENSE environment variable with your license key.\\n' +\n            'Learn more: https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE',\n        );\n      }\n    } catch (err) {\n      if (err instanceof Error && err.message.startsWith('[mastra/auth-ee]')) {\n        throw err;\n      }\n      // @mastra/core/auth/ee module not available — Agent Builder cannot function\n      throw new Error(\n        '[mastra/auth-ee] Agent Builder is configured but the EE module (@mastra/core/auth/ee) could not be loaded.\\n' +\n          'Ensure @mastra/core is updated to a version that includes EE support.',\n      );\n    }\n  }\n\n  /**\n   * Validate route-level FGA policy coverage when an FGA provider opts into\n   * startup checks.\n   */\n  async validateFGAPolicyCoverage(): Promise<void> {\n    const serverConfig = this.mastra.getServer();\n    const studioConfig = this.mastra.getStudio?.();\n    // Check both server and studio FGA providers\n    const fgaProvider = serverConfig?.fga ?? studioConfig?.fga;\n    if (!fgaProvider) return;\n\n    const customRoutes = (this.customApiRoutes ?? serverConfig?.apiRoutes ?? []).filter(","sourceCodeStart":876,"sourceCodeEnd":912,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/server-adapter/index.ts#L876-L912","documentation":"Thrown when Agent Builder is configured/enabled but the dynamic import of @mastra/core/auth/ee fails, meaning the installed @mastra/core has no EE module. Since Agent Builder depends on the EE licensing layer, the adapter throws with guidance to update @mastra_core. Pre-existing [mastra/auth-ee] errors are rethrown as-is.","triggerScenarios":"Enabling Agent Builder with an @mastra/core version lacking the auth/ee subpath export, a corrupted or partially installed node_modules, or a build/bundler setup that breaks dynamic import of the subpath.","commonSituations":"Mixed package versions in a pnpm workspace (stale @mastra/core build); forgetting `pnpm install` after upgrading server packages; using a bundler that cannot resolve dynamic imports of package subpath exports; running from a stale dist directory.","solutions":["Update @mastra/core to the latest version that includes EE support.","Clean and reinstall dependencies (pnpm install; optionally remove node_modules) and rebuild @mastra/core if in-workspace.","Verify the auth/ee export exists: check @mastra/core/package.json exports for './auth/ee'.","Align all @mastra/* package versions so peers resolve to a single @mastra/core copy."],"exampleFix":"// before\npnpm --filter @mastra/server build // @mastra/core stale at pre-EE version\n\n// after\npnpm install && pnpm --filter @mastra/core build && pnpm --filter @mastra/server build","handlingStrategy":"validation","validationCode":"if (mastra.getEditor()?.hasEnabledBuilderConfig?.()) {\n  try {\n    await import('@mastra/core/auth/ee');\n  } catch {\n    throw new Error('Agent Builder enabled but @mastra/core/auth/ee is missing — update @mastra/core to a version with EE support');\n  }\n}","typeGuard":"function isEeModuleMissingForBuilder(err: unknown): boolean {\n  return err instanceof Error &&\n    err.message.includes('[mastra/auth-ee]') &&\n    err.message.includes('Agent Builder') &&\n    err.message.includes('could not be loaded');\n}","tryCatchPattern":"try {\n  await startServer(mastra);\n} catch (e) {\n  if (isEeModuleMissingForBuilder(e)) {\n    console.error('Upgrade @mastra/core so the EE module needed by Agent Builder resolves.');\n    process.exitCode = 1;\n    return;\n  }\n  throw e;\n}","preventionTips":["Pin all @mastra/* packages to matching versions in package.json.","Rebuild @mastra/core dist in monorepos before starting the server.","Smoke-test EE-dependent boots in CI with a build that includes the auth/ee export.","Reinstall dependencies after any upgrade touching @mastra/core."],"tags":["licensing","enterprise","agent-builder","module-resolution","version-mismatch"],"backgroundTag":"module-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}