Incorrect DATETIME value: '0' - in plugin CustomReports

Hi, I’m getting a bunch of errors lately during archive (only noticed now by accident).
I’m on Matomo 5.1.0 and CustomReports 5.0.15.

The DATETIME value can be 0 or 1 in the error message, otherwise they look the same to me:

Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2024-08-11&format=json&segment=profilable%3D%3D0&trigger=archivephp. Response was '{"result":"error","message":"SQLSTATE[HY000]: General error: 1525 Incorrect DATETIME value: '0' - in plugin CustomReports.
#0 /var/www/dbuser/core/ArchiveProcessor/Loader.php(317): Piwik\\ArchiveProcessor\\PluginsArchiver->callAggregateAllPlugins()
#1 /var/www/dbuser/core/ArchiveProcessor/Loader.php(186): Piwik\\ArchiveProcessor\\Loader->prepareAllPluginsArchive()
#2 /var/www/dbuser/core/ArchiveProcessor/Loader.php(165): Piwik\\ArchiveProcessor\\Loader->insertArchiveData()
#3 /var/www/dbuser/core/ArchiveProcessor/Loader.php(105): Piwik\\ArchiveProcessor\\Loader->prepareArchiveImpl()
#4 /var/www/dbuser/core/Context.php(76): Piwik\\ArchiveProcessor\\Loader->Piwik\\ArchiveProcessor\\{closure}()
#5 /var/www/dbuser/core/ArchiveProcessor/Loader.php(109): Piwik\\Context::changeIdSite()
#6 /var/www/dbuser/plugins/CoreAdminHome/API.php(306): Piwik\\ArchiveProcessor\\Loader->prepareArchive()
#7 [internal function]: Piwik\\Plugins\\CoreAdminHome\\API->archiveReports()
#8 /var/www/dbuser/core/API/Proxy.php(255): call_user_func_array()
#9 /var/www/dbuser/core/Context.php(29): Piwik\\API\\Proxy->Piwik\\API\\{closure}()
#10 /var/www/dbuser/core/API/Proxy.php(346): Piwik\\Context::executeWithQueryParameters()
#11 /var/www/dbuser/core/API/Request.php(274): Piwik\\API\\Proxy->call()
#12 /var/www/dbuser/plugins/API/Controller.php(46): Piwik\\API\\Request->process()
#13 [internal function]: Piwik\\Plugins\\API\\Controller->index()
#14 /var/www/dbuser/core/FrontController.php(645): call_user_func_array()
#15 /var/www/dbuser/core/FrontController.php(169): Piwik\\FrontController->doDispatch()
#16 /var/www/dbuser/core/dispatch.php(33): Piwik\\FrontController->dispatch()
#17 /var/www/dbuser/index.php(25): require_once('...')
#18 /var/www/dbuser/core/CliMulti/RequestCommand.php(76): require_once('...')
#19 /var/www/dbuser/core/Plugin/ConsoleCommand.php(109): Piwik\\CliMulti\\RequestCommand->doExecute()
#20 /var/www/dbuser/vendor/symfony/console/Command/Command.php(298): Piwik\\Plugin\\ConsoleCommand->execute()
#21 /var/www/dbuser/core/Plugin/ConsoleCommand.php(124): Symfony\\Component\\Console\\Command\\Command->run()
#22 /var/www/dbuser/vendor/symfony/console/Application.php(1040): Piwik\\Plugin\\ConsoleCommand->run()
#23 /var/www/dbuser/vendor/symfony/console/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand()
#24 /var/www/dbuser/core/Console.php(113): Symfony\\Component\\Console\\Application->doRun()
#25 [internal function]: Piwik\\Console->originDoRun()
#26 /var/www/dbuser/core/Console.php(152): call_user_func()
#27 /var/www/dbuser/core/Access.php(672): Piwik\\Console->Piwik\\{closure}()
#28 /var/www/dbuser/core/Console.php(153): Piwik\\Access::doAsSuperUser()
#29 /var/www/dbuser/core/Console.php(92): Piwik\\Console->doRunImpl()
#30 /var/www/dbuser/vendor/symfony/console/Application.php(171): Piwik\\Console->doRun()
#31 /var/www/dbuser/console(32): Symfony\\Component\\Console\\Application->run()
#32 {main}, caused by: SQLSTATE[HY000]: General error: 1525 Incorrect DATETIME value: '0'
#0 /var/www/dbuser/libs/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute()
#1 /var/www/dbuser/libs/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute()
#2 /var/www/dbuser/libs/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query()
#3 /var/www/dbuser/core/Db/Adapter/Pdo/Mysql.php(336): Zend_Db_Adapter_Pdo_Abstract->query()
#4 [internal function]: Piwik\\Db\\Adapter\\Pdo\\Mysql->query()
#5 /var/www/dbuser/core/DataAccess/ArchivingDbAdapter.php(119): call_user_func_array()
#6 /var/www/dbuser/core/DataAccess/ArchivingDbAdapter.php(60): Piwik\\DataAccess\\ArchivingDbAdapter->callFunction()
#7 /var/www/dbuser/plugins/CustomReports/RecordBuilders/CustomReport.php(299): Piwik\\DataAccess\\ArchivingDbAdapter->query()
#8 /var/www/dbuser/plugins/CustomReports/RecordBuilders/CustomReport.php(148): Piwik\\Plugins\\CustomReports\\RecordBuilders\\CustomReport->aggregateReport()
#9 /var/www/dbuser/core/ArchiveProcessor/RecordBuilder.php(98): Piwik\\Plugins\\CustomReports\\RecordBuilders\\CustomReport->aggregate()
#10 /var/www/dbuser/core/Plugin/Archiver.php(205): Piwik\\ArchiveProcessor\\RecordBuilder->buildFromLogs()
#11 /var/www/dbuser/core/ArchiveProcessor/PluginsArchiver.php(186): Piwik\\Plugin\\Archiver->callAggregateDayReport()
#12 /var/www/dbuser/core/ArchiveProcessor/Loader.php(317): Piwik\\ArchiveProcessor\\PluginsArchiver->callAggregateAllPlugins()
#13 /var/www/dbuser/core/ArchiveProcessor/Loader.php(186): Piwik\\ArchiveProcessor\\Loader->prepareAllPluginsArchive()
#14 /var/www/dbuser/core/ArchiveProcessor/Loader.php(165): Piwik\\ArchiveProcessor\\Loader->insertArchiveData()
#15 /var/www/dbuser/core/ArchiveProcessor/Loader.php(105): Piwik\\ArchiveProcessor\\Loader->prepareArchiveImpl()
#16 /var/www/dbuser/core/Context.php(76): Piwik\\ArchiveProcessor\\Loader->Piwik\\ArchiveProcessor\\{closure}()
#17 /var/www/dbuser/core/ArchiveProcessor/Loader.php(109): Piwik\\Context::changeIdSite()
#18 /var/www/dbuser/plugins/CoreAdminHome/API.php(306): Piwik\\ArchiveProcessor\\Loader->prepareArchive()
#19 [internal function]: Piwik\\Plugins\\CoreAdminHome\\API->archiveReports()
#20 /var/www/dbuser/core/API/Proxy.php(255): call_user_func_array()
#21 /var/www/dbuser/core/Context.php(29 ... n#44 /var/www/dbuser/console(32): Symfony\\Component\\Console\\Application->run()\n#45 {main}"}'

Any ideas what could be causing this?