"java.sql.BatchUpdateException: (conn=965289) Duplicate entry" thrown while ticking/unticking 'Auto Sync User Sets' under Subscriptions Configuration for a SubscriptionDescriptionError such as "java.sql.SQLException: Duplicate entry 'LICTBLUDdd287311db3c87806bc4ff661d96199a' for key 'ryiowcsk_defid_unique_index'" is seen when ticking/unticking the "Auto Sync User Sets" checkbox under 'Subscriptions Configuration' for example the Subscription named "IT Service Management Standard - Fulfiller User v2". The error is issued because of a duplicate entry in the [usageanalytics_count_cfg] table for 'definition_id' (LICTBLUDdd287311db3c87806bc4ff661d96199a). Full error log is as follows: 2020-07-27 00:13:55 (605) Default-thread-16 0E0B40CDDB1A5C10CB3FF9F51D96191C txid=d8df8805db5a SEVERE *** ERROR *** FAILED TRYING TO EXECUTE ON CONNECTION glide.31 (connpid=965289): INSERT INTO sys_metadata (`sys_replace_on_upgrade`,`sys_updated_on`,`sys_class_name`,`sys_id`,`sys_updated_by`,`sys_created_on`,`sys_name`,`sys_scope`,`sys_created_by`,`sys_mod_count`,`sys_package`,`sys_update_name`,`sys_customer_update`,`sys_policy`) VALUES(0,'2020-07-27 07:13:55','usageanalytics_count_cfg','a0df4085db5a5c10cb3ff9f51d961949','Murtaza.Iqbal@dazn.com','2020-07-27 07:13:55','LICTBLCTdd287311db3c87806bc4ff661d96199a','global','xxxx',0,'global','usageanalytics_count_cfg_a0df4085db5a5c10cb3ff9f51d961949',0,'read'),INSERT INTO usageanalytics_count_cfg (`description`,`overridden`,`run_scope`,`agg_type`,`sys_id`,`definition_id`,`exec_time_threshold`,`count_type`,`active`,`license_model`,`reportable`,`script`,`schedule`,`name`) VALUES('Get the count of IT Service Management Standard - Fulfiller User v2 tables included count monthly',0,'global','count','a0df4085db5a5c10cb3ff9f51d961949','LICTBLCTdd287311db3c87806bc4ff661d96199a',500,'Licensing',1,'0',0,'answer = getCount();function getCount() { var gr = new GlideRecord(''license_details''); gr.addQuery(''end_date>javascript:gs.beginningOfLastMonth()^license_id=dd287311db3c87806bc4ff661d96199a''); gr.query(); if (gr.next()) return parseInt(gr.getValue(''table_count'')); else return parseInt(''0'');}','Monthly','IT Service Management Standard - Fulfiller User v2 Tables Included')java.sql.BatchUpdateException: (conn=965289) Duplicate entry 'LICTBLCTdd287311db3c87806bc4ff661d96199a' for key 'pkxwjsqd_defid_unique_index'Steps to Reproduce Access the Subscriptions Configuration named 'IT Service Management Standard - Fulfiller User v2' [license_details].Tick/Untick the "Auto Sync user sets" checkbox (tick or untick) under 'Subscription Configuration'.Observe the error "java.sql.SQLException: Duplicate entry 'LICTBLUDdd287311db3c87806bc4ff661d96199a' for key 'ryiowcsk_defid_unique_index'"WorkaroundAfter carefully considering the severity and frequency of this problem and the risk of attempting a fix, it has been decided to not address this issue in any current or future releases. In Paris, we've significantly reduced the need to create user sets with the introduction of System Entitlements and in Quebec, we are depreciating User Sets. We do not make these decisions lightly, and we apologize for any inconvenience. As a workaround, the 'Script or Table Name' field of the UsageAnalytics Count Configuration records must be corrected so that the first part matches the Subscription name. For example, for the Subscription named "IT Service Management Standard - Fulfiller User v2", there are 5 entries in the UsageAnalytics Count Configuration table [usageanalytics_count_cfg] with 'Script or Table Name' having the following values: IT Service Management - Fulfiller User v2 Tables Included IT Service Management - Fulfiller User v2 allocated IT Service Management - Fulfiller User v2 Tables Mapped IT Service Management - Fulfiller User v2 purchased IT Service Management - Fulfiller User v2 Non-subscribed UsersThe first part of these values must be modified so that it's the same as "IT Service Management Standard - Fulfiller User v2". "IT Service Management - Fulfiller User v2 Tables Included" should be replaced with "IT Service Management Standard - Fulfiller User v2 Tables Included"Related Problem: PRB1419999