Error MessageUnique Key violation detected by database (Duplicate entry '6084e6e91d2a9850f2857e112180976d' for key 'PRIMARY') keeps appearing when ticket is moved to 'Closed Complete' State

Morgan13
Kilo Contributor

When moving the state of a record from 'Audit' to 'Closed Complete', the following error : " Error MessageUnique Key violation detected by database (Duplicate entry '6084e6e91d2a9850f2857e112180976d' for key 'PRIMARY')" keeps appearing. Through review of other forums, we have tried looking through business rules, ui actions, and other scripts to see if there are current.update() lines included and we have also made all business rules/ui actions 'InActive' to see if those were the scripts that were causing the error but it still appears on the record. We have also checked the logs which shows the following portion of the log:

"FAILED TRYING TO EXECUTE ON CONNECTION 12: INSERT INTO task (`a_str_17`, `a_num_1`, `made_sla`, `upon_reject`, `sys_updated_on`, `sys_class_name`, `number`, `sys_id`, `sys_updated_by`, `opened_by`, `urgency`, `sys_created_on`, `sys_domain`, `state`, `reassignment_count`, `sys_created_by`, `a_bln_3`, `knowledge`, `a_bln_1`, `approval`, `impact`, `a_bln_2`, `sys_mod_count`, `active`, `priority`, `sys_domain_path`, `opened_at`, `escalation`, `upon_approval`, `approval_set`) VALUES(' - ', 0, 1, 'cancel', '2020-08-13 14:41:30', 'sn_rivt_stig_ci_m2m', 'STIG0001141', '6084e6e91d2a9850f2857e112180976d', 'JSingh', '286a746835559890f2851356638b0f81', 3, '2020-08-13 14:41:30', 'global', 1, 0, 'JSingh', 0, 0, 0, 'not requested', 3, 0, 0, 1, 4, '/', '2020-08-13 14:41:30', 0, 'proceed', NULL) /* cpar, gs:850B306A1DEA1C50F2857E1121809719, tx:9249192e1daa1c50f2857e1121809709 */
Unique Key violation detected by database (Duplicate entry '6084e6e91d2a9850f2857e112180976d' for key 'PRIMARY')
: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '6084e6e91d2a9850f2857e112180976d' for key 'PRIMARY': org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:132)
org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:274)" 

with more lines afterwards with the same format. With this information, what should be checked in order to find this duplicate value for the sys_id field? None of the fields for the appropriate table are made to be unique in the dictionary so what could be the source of the error? Any input would be helpful. Thank you

3 REPLIES 3

Michael Kaufman
Giga Guru

I would look into business rules that reference the sn_rivt_stig_ci_m2m table.  Business Rule might be running on the sn_rivt_stig_ci_m2m table.

Thanks for the answer, it seems as though all the Business Rules associated for that table are not Active though.

Prateek kumar
Mega Sage

See if the below helps?

https://community.servicenow.com/community?id=community_question&sys_id=50614729db98dbc01dcaf3231f96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks