A common way to install a site, especially when running the test suite, is to set the database URL in the settings.php or settings.local.php file and run the core/scripts/install.sh script. However, the existence of the URL setting is enough to make the install code think the site has been setup already, and fails.
The installer should check if the database is actually present and populated before failing.