com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'XYZ-UUID' for key 'PRIMARY'

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips


Check whether privilege has the "not null" restriction. If so it always has to have a value and can never be null.

A different reason could be a wrong implementation of a foreign key. Check whether you always correctly insert/update in both tables.

Solutions on the web

via GitHub by erocs
, 1 year ago
Duplicate entry 'UUID REMOVED' for key 'PRIMARY'
via GitHub by tinchoabbate
, 3 months ago
Cannot delete or update a parent row: **a foreign key constraint fails (`java`.`articulos_secciones`, CONSTRAINT `articulo` FOREIGN KEY (`idArticulo`) REFERENCES `articulos` (`idArticulo`) ON DELETE NO ACTION ON UPDATE NO ACTION)**
via Stack Overflow by Paul Statham
, 2 years ago
Duplicate entry '7-1' for key 'PRIMARY'
via by Unknown author, 2 years ago
Duplicate entry 'Jane Austin' for key 'PRIMARY'
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'XYZ-UUID' for key 'PRIMARY'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at com.mysql.jdbc.Util.handleNewInstance(
at com.mysql.jdbc.Util.getInstance(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.sendCommand(
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
at com.mysql.jdbc.ConnectionImpl.execSQL(
at com.mysql.jdbc.PreparedStatement.executeInternal(
at com.mysql.jdbc.PreparedStatement.execute(
at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.bukkit.plugin.RegisteredListener.callEvent(
at org.bukkit.plugin.SimplePluginManager.fireEvent(
at org.bukkit.plugin.SimplePluginManager.callEvent(
at net.minecraft.server.v1_10_R1.PlayerList.onPlayerJoin(

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
4 times, 4 months ago
Once, 3 weeks ago
3 times, 1 year ago
2 times, 2 months ago
70 more bugmates

Know the solutions? Share your knowledge to help other developers to debug faster.