AutoSPInstaller is a great project that facilitates Automated SharePoint installation including Sharepoint 2010, 2013, 2016 and 2019.
Auto SP Installer provides a powerful way to deploy and configure a
single-server development environment to multiple-server SharePoint farm.
When creating the Web Application via AutoSPInstaller, the script failed because the content database required to be upgraded.
Error
New-SPWebApplication: This content database requires upgrade and could not be attached in this operation.

Solution:
When the AutoSPInstaller failed earlier, it had initially created the Content database, but hadn’t finished configuring the database, hence the error.
Delete the Content Database from SQL Server and re-run the AutoSPInstaller script.