Duplicate key values

2
Hi all, I seem to be getting this error, but not every time the microflow is run and I am not sure why.  I’ve had this problem for a while now and have done the following: - Made sure there are not multiple commits for the same entity in the microflow or the sub microflows it calls, there is only one, but a couple of change events.  - Made it so the microflow cannot be run twice, it is disabled during action   2022-05-20T08:23:48.736814 [APP/PROC/WEB/0]   ERROR - Connector: An error has occurred while handling the request. [User 'firstname.surname@mencap.org.uk' with session id '6dcad744-XXXX-XXXX-XXXX-XXXXXXXXb437' and roles 'SupportWorker'] 2022-05-20T08:23:48.736849 [APP/PROC/WEB/0]   ERROR - Connector: com.mendix.modules.microflowengine.MicroflowException: Failed to commit 2022-05-20T08:23:48.736853 [APP/PROC/WEB/0]       at DailySupportRecord.ACT_SavePersonalCare (Change : 'Change 'PlannedActivity' (newrecord, PersonalCare_PlannedActivity, IsThisADraft, LockTime)') 2022-05-20T08:23:48.736872 [APP/PROC/WEB/0]   Advanced stacktrace: 2022-05-20T08:23:48.736885 [APP/PROC/WEB/0]       at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:83) 2022-05-20T08:23:48.736998 [APP/PROC/WEB/0]   Caused by: com.mendix.core.CoreRuntimeException: Failed to commit 2022-05-20T08:23:48.737027 [APP/PROC/WEB/0]       at com.mendix.basis.component.TransactionCore.commit(TransactionCore.scala:149) 2022-05-20T08:23:48.737042 [APP/PROC/WEB/0]   Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.data.UniqueConstraintViolationRuntimeException: Duplicate column value violates its unique constraint: ERROR: duplicate key value violates unique constraint "dailysupportrecord$personalcare_pkey" 2022-05-20T08:23:48.737080 [APP/PROC/WEB/0]     Detail: Key (id)=(10977524093432192) already exists. (SQL State: 23505, Error Code: 0) 2022-05-20T08:23:48.737099 [APP/PROC/WEB/0]       at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:110) 2022-05-20T08:23:48.737165 [APP/PROC/WEB/0]   Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.data.UniqueConstraintViolationRuntimeException: Duplicate column value violates its unique constraint: ERROR: duplicate key value violates unique constraint "dailysupportrecord$personalcare_pkey" 2022-05-20T08:23:48.737292 [APP/PROC/WEB/0]     Detail: Key (id)=(10977524093432192) already exists. (SQL State: 23505, Error Code: 0) 2022-05-20T08:23:48.737299 [APP/PROC/WEB/0]       at com.mendix.util.classloading.Runner$.withContextClassLoader(Runner.scala:23) 2022-05-20T08:23:48.737306 [APP/PROC/WEB/0]   Caused by: com.mendix.systemwideinterfaces.connectionbus.data.UniqueConstraintViolationRuntimeException: Duplicate column value violates its unique constraint: ERROR: duplicate key value violates unique constraint "dailysupportrecord$personalcare_pkey" 2022-05-20T08:23:48.737310 [APP/PROC/WEB/0]     Detail: Key (id)=(10977524093432192) already exists. (SQL State: 23505, Error Code: 0)   Here is the part microflow the microflow that errors (though the microflow still completes) The error message shows it erroring specifically at at the Change activity for the planned activity   Looking at this I have a commit of an association. Would I be correct in saying the personal care entity is being autocommited, and when it commits itself in the next action it’s possible both commits try to happen simultaneously and the error happens?
asked
1 answers
1

Hi Garion,

unfortunately I do not have a solution for your issue, but we have a similar issue in our project with random occurrences of the duplicated PKEY error in some microflows. We are currently investigating the application with the Mendix Support, but have not found a solution or the cause of this issue yet.

If I we find a solution I will add it here.

Best regards 
Kevin

 

answered