Follow steps below to solve the issue with this crazy error related to creating Personal Sites in SharePoint 2013 / SharePoint 2016 namely "Exception calling "CreatePersonalSite" with "0" argument(s): "A failure was encountered while attempting to create the site." -
1) Navigate to Content Databases <central admin url>/_admin/cntdbadm.aspx
2) Ensure the Current number of Site Collections is less than the Maximum Number of Site Collections settings.
3) If not then increase the Maximum Number of Site Collections settings to ensure its significantly greater than current number of Site Collections
4) Re-run your PowerShell Script