Doctrine Error

Please I need help with this error.

[2024-06-25T01:44:34.254235+00:00] mautic.ERROR: Doctrine\Migrations\Exception\MetadataStorageError: The metadata storage is not initialized, please run the sync-metadata-storage command to fix this issue. (uncaught exception) at /home/m.website.com/public_html/vendor/doctrine/migrations/lib/Doctrine/Migrations/Exception/MetadataStorageError.php line 18 while running console command `doctrine:migrations:version` [stack trace] #0 /home/m.website.com/public_html/vendor/doctrine/migrations/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php(221): Doctrine\Migrations\Exception\MetadataStorageError::notInitialized() #1 /home/m.website.com/public_html/vendor/doctrine/migrations/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php(122): Doctrine\Migrations\Metadata\Storage\TableMetadataStorage->checkInitialization() #2 /home/m.website.com/public_html/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php(244): Doctrine\Migrations\Metadata\Storage\TableMetadataStorage->complete() #3 /home/m.website.com/public_html/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php(159): Doctrine\Migrations\Tools\Console\Command\VersionCommand->mark() #4 /home/m.website.com/public_html/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php(123): Doctrine\Migrations\Tools\Console\Command\VersionCommand->markVersions() #5 /home/m.website.com/public_html/vendor/symfony/console/Command/Command.php(298): Doctrine\Migrations\Tools\Console\Command\VersionCommand->execute() #6 /home/m.website.com/public_html/vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run() #7 /home/m.website.com/public_html/vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand() #8 /home/m.website.com/public_html/vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() #9 /home/m.website.com/public_html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun() #10 /home/m.website.com/public_html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun() #11 /home/m.website.com/public_html/docroot/app/bundles/InstallBundle/Install/InstallService.php(499): Symfony\Component\Console\Application->run() #12 /home/m.website.com/public_html/docroot/app/bundles/InstallBundle/Command/InstallCommand.php(434): Mautic\InstallBundle\Install\InstallService->finalMigrationStep() #13 /home/m.website.com/public_html/docroot/app/bundles/InstallBundle/Command/InstallCommand.php(340): Mautic\InstallBundle\Command\InstallCommand->stepAction() #14 /home/m.website.com/public_html/vendor/symfony/console/Command/Command.php(298): Mautic\InstallBundle\Command\InstallCommand->execute() #15 /home/m.website.com/public_html/vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run() #16 /home/m.website.com/public_html/vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand() #17 /home/m.website.com/public_html/vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() #18 /home/m.website.com/public_html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun() #19 /home/m.website.com/public_html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun() #20 /home/m.website.com/public_html/bin/console(16): Symfony\Component\Console\Application->run() #21 {main} [] {"hostname":"ubuntu-16gb-hel1-1","pid":90144}
[2024-06-25T01:44:34.254796+00:00] mautic.WARNING: Command `doctrine:migrations:version` exited with status code 1 [] {"hostname":"ubuntu-16gb-hel1-1","pid":90144}
[2024-06-25T01:44:34.975285+00:00] mautic.WARNING: Command `mautic:assets:generate` exited with status code 1 [] {"hostname":"ubuntu-16gb-hel1-1","pid":90189}

I get the same error when reinstalling in a local Docker environment.

This seems to be triggered by Doctrine when it cannot determine the version of the database server. According to this discussion, this is related to MariaDB servers and can be fixed by specifying the server version in the Doctrine configuration as mariadb-<server-version> instead of <server-version>. Unfortunately, there seems to be no way to specify the server version in Mautic. The closest is the MAUTIC_DB_SERVER_VERSION constant in /app/AppKernel.php, but I have no idea how to set it persistently.


Environment:

Mautic 5.1.0
Composer 2.7.1
PHP 8.2.7
Apache 2.4.57
MariaDB 10.5.18

The problem specifically in Mautic might be, that the MAUTIC_DB_SERVER_VERSION is set to null if /config/local.php exists, probably due to the assumption that Mautic is already installed if that file exists. But in my installation process i use to prefill the local.php with some additional parameters that i cannot hand over to the installation CLI command, like e.g. api_enabled.

The error definitely occurs during the Mautic installation, e.g. during

php bin/console mautic:install <local-url>

and it is triggered regardless of whether a config/local.php exists.