WordPress Multsite: PHP Fatal error: Uncaught Zend_Db_Statement_Exception

Hi Matomo Folks,

I am using the Matomo Analytics WordPress Plugin, Version 5.0.3, on a WordPress multisite that has the following specs:
PHP Version 8.2.17
WordPress Version: 6.2.4

Currently, we are getting a critical error on the site when attempting to add a new User to the site when the Matomo Analytics plugin is activated:

[12-Aug-2024 16:02:33 UTC] Matomo: Matomo is now creating a user forUserId 2423 with matomo login tee
[12-Aug-2024 16:02:33 UTC] Matomo: Matomo is now creating a user forUserId 234 with matomo login ree_86b86
[12-Aug-2024 16:02:33 UTC] Matomo: Matomo is now creating a user forUserId 222 with matomo login ree_cdc18
[12-Aug-2024 16:02:34 UTC] WordPress database error Duplicate entry ‘’ for key ‘uniq_email’ for query INSERT INTO wp_589_matomo_user (login, password, email, date_registered, superuser_access, ts_password_modified, idchange_last_viewed, invited_by) VALUES (‘ree_cdc18’, ‘$2y$10$8wvkUQe3YdEWG234gDFGDF23fASFSDHV34sV/se0FRsdfhshcvS6.aqi’, ‘’, ‘2024-08-12 16:02:33’, ‘0’, ‘2024-08-12 16:02:34’, NULL, NULL) made by wpmu_activate_signup, wpmu_create_user, wp_create_user, wp_insert_user, WP_User->set_role, do_action(‘add_user_role’), WP_Hook->do_action, WP_Hook->apply_filters, WpMatomo\User\Sync->sync_current_users_1000, WpMatomo\User\Sync->sync_users, WpMatomo\User\Sync->ensure_user_exists, Piwik\Plugins\UsersManager\Model->addUser, Piwik\Db\Adapter\WordPress->insert
[12-Aug-2024 16:02:34 UTC] PHP Fatal error: Uncaught Zend_Db_Statement_Exception: WP DB Error: [1062] Duplicate entry ‘’ for key ‘uniq_email’ in D:\wp_dir\wp-content\plugins\matomo\classes\WpMatomo\Db\WordPress.php:407

Stack trace:
#0 D:\wp_dir\wp-content\plugins\matomo\classes\WpMatomo\Db\WordPress.php(461): Piwik\Db\Adapter\WordPress->after_execute_query()
#1 D:\wp_dir\wp-content\plugins\matomo\app\plugins\UsersManager\Model.php(429): Piwik\Db\Adapter\WordPress->insert()
#2 D:\wp_dir\wp-content\plugins\matomo\classes\WpMatomo\User\Sync.php(356): Piwik\Plugins\UsersManager\Model->addUser()
#3 D:\wp_dir\wp-content\plugins\matomo\classes\WpMatomo\User\Sync.php(209): WpMatomo\User\Sync->ensure_user_exists()
#4 D:\wp_dir\wp-content\plugins\matomo\classes\WpMatomo\User\Sync.php(174): WpMatomo\User\Sync->sync_users()
#5 D:\wp_dir\wp-includes\class-wp-hook.php(306): WpMatomo\User\Sync->sync_current_users_1000()
#6 D:\wp_dir\wp-includes\class-wp-hook.php(332): WP_Hook->apply_filters()
#7 D:\wp_dir\wp-includes\plugin.php(517): WP_Hook->do_action()
#8 D:\wp_dir\wp-includes\class-wp-user.php(638): do_action()
#9 D:\wp_dir\wp-includes\user.php(2445): WP_User->set_role()
#10 D:\wp_dir\wp-includes\user.php(2762): wp_insert_user()
#11 D:\wp_dir\wp-includes\ms-functions.php(1313): wp_create_user()
#12 D:\wp_dir\wp-includes\ms-functions.php(1181): wpmu_create_user()
#13 D:\wp_dir\wp-admin\user-new.php(231): wpmu_activate_signup()
#14 {main}
** thrown in D:\wp_dir\wp-content\plugins\matomo\classes\WpMatomo\Db\WordPress.php on line 407**

Could you please advise if you’ve seen this before and have a workaround?

Best regards,
Matthew Huntley

Hi Matomo Folks,

Just wanted to follow up on this thread. Could you please advise and/or let me know if you need additional information?

Best regards,
Matthew Huntley

Hi @MatthewHuntley
Log seems like you try to add a user without email address… ?

Hi @heurteph-ei,
Thanks for following up.
To answer your question, no, in each instance, we’ve always chosen a Username and Email address (as these values are required by WordPress).
If you have any additional feedback, I’d appreciate it.
Best regards,
Matthew Huntley