SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

While updating Matomo to 4.0.1 (from 3.14.1) I get the following error report:
" Kritischer Fehler während der Aktualisierung:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘…’ for key ‘PRIMARY’"

When I try to access matomo, I am forwarded to the updater again.
But I get the same error.

Any ideas how to solve the problem?

Same error here but I could update after changing the core_version entry directly in the mysql table ‘options’. Matamo was updated succesfully but refuses to let me in with my password and login name. I could change the password but with the new one I could nog get in either.

Kees

I am having exactly the same problem here:

Kritischer Fehler während der Aktualisierung:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘xxx’ for key 'PRIMARY’

Also upgrading from 3.14.1 to 4.0.1. Also German language.

I am also stuck in a loop and do not have any idea how to fix this.

Hi,

Can you please check your error log to see if you can find a more verbose error that also mentions in which table or for which key the duplicate entry occurs?

The same issue has also been reported here:

Can you please check your error log to see if you can find a more verbose error that also mentions in which table or for which key the duplicate entry occurs?

I can’t find any duplicate error entries in my matomo.log. Seems instead that some tables are missing.

Maybe you can see more?

My matomo.log: https://pastebin.com/SNv1h5Ge

It seems like the solution to this issue is to truncate/delete everything in the piwik_session or matomo_session (this will log everyone out) and then continue with the update.

Lukas, thanks a lot. Manually deleting every entry from the session table did solve the problem. I was now able to update Matomo and had to re-login again afterwards.

1 Like