Unique Key violation detected by database Duplicate entry '' for key 'channel_user_profile'

varunagarwal83
Tera Contributor

I’ve recently created and published a NASK skill to the Now Assist Panel. After publishing, I’m encountering a red ribbon error message across various pages in ServiceNow:

Error Message: Unique Key violation detected by database ((conn=206040) Duplicate entry '93ad7ede9719e6108046371f2153af3e' for key 'channel_user_profile'

Upon investigation, I found an existing entry in the Channel User Profile table with my name associated with a specific Sys_id.

Could you please help me understand why this error is occurring after publishing the skill? Is this expected behavior, or is there a misconfiguration that needs to be addressed?

1 ACCEPTED SOLUTION

Jordan Blake
Kilo Sage

We're getting the same error. I opened a Support Case because our employees are getting these errors constantly after using the Now Assist Panel. Here is the latest response:

 

Issue:
Error message is occurring referring to a unique key violation for the channel_user_profile


Most Probable Cause:
This is a known issue tracked by PRB1883603 and corrected in Zurich where there is a constraint on the sys_cs_channel_user_profile table to have only one entry per channel but the Now Assist Panel creates a new entry for each user.


Solution Proposed:
As a workaround one of the duplicate values on the sys_cs_channel_user_profile can be made inactive. Look to move to Zurich as soon as you can to benefit from the full fix.

Next Steps:
Essentially this is a mismatch between the setup for the table sys_cs_channel_user_profile and how the Now Assist Panel has been created to use it. You should see no functionality impact besides the error showing and each user that accesses the Now Assist Panel will create another entry in the sys_cs_channel_user_profile table that needs to be made inactive.

 

 

I will note, for me, this is not yet convincing, and not a true solution.... Looking deeper I found errors like these in the logs:

FAILED TRYING TO EXECUTE ON CONNECTION glide.16 (connpid=76771012): INSERT INTO sys_cs_skill_context (`sys_mod_count`,`sys_updated_on`,`url`,`channel_user_profile`,`sys_id`,`route`,`sys_updated_by`,`context_table`,`custom_context`,`sys_created_on`,`experience_name`,`context_id`,`sys_created_by`,`consumer_account_id`) VALUES(0,'2025-06-25 19:16:07','sn_customerservice_case.do?sys_id=<REDACTED sys_id>&sysparm_view=case&sysparm_record_target=sn_customerservice_case&sysparm_record_row=1&sysparm_record_rows=3&sysparm_record_list=<REDACTED EncodedQuery>&sysparm_view=case','<REDACTED sys_id>','<REDACTED sys_id>','record','<REDACTED email>','sn_customerservice_case','{}','2025-06-25 19:16:07','Core UI','<REDACTED sys_id>','<REDACTED email>','<REDACTED sys_id>') /* <REDACTED node>, gs:..., tx:... */
Unique Key violation detected by database ((conn=76771012) Duplicate entry '<REDACTED sys_id>' for key 'channel_user_profile')
: java.sql.SQLIntegrityConstraintViolationException: (conn=76771012) Duplicate entry '<REDACTED sys_id>' for key 'channel_user_profile':

 

I'm attempting a custom fix now, and will report back with any updates from Support or what I was able to do to patch this.

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @varunagarwal83 

I think you need to change the name of the skill, as it’s causing a conflict in the database.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Jordan Blake
Kilo Sage

We're getting the same error. I opened a Support Case because our employees are getting these errors constantly after using the Now Assist Panel. Here is the latest response:

 

Issue:
Error message is occurring referring to a unique key violation for the channel_user_profile


Most Probable Cause:
This is a known issue tracked by PRB1883603 and corrected in Zurich where there is a constraint on the sys_cs_channel_user_profile table to have only one entry per channel but the Now Assist Panel creates a new entry for each user.


Solution Proposed:
As a workaround one of the duplicate values on the sys_cs_channel_user_profile can be made inactive. Look to move to Zurich as soon as you can to benefit from the full fix.

Next Steps:
Essentially this is a mismatch between the setup for the table sys_cs_channel_user_profile and how the Now Assist Panel has been created to use it. You should see no functionality impact besides the error showing and each user that accesses the Now Assist Panel will create another entry in the sys_cs_channel_user_profile table that needs to be made inactive.

 

 

I will note, for me, this is not yet convincing, and not a true solution.... Looking deeper I found errors like these in the logs:

FAILED TRYING TO EXECUTE ON CONNECTION glide.16 (connpid=76771012): INSERT INTO sys_cs_skill_context (`sys_mod_count`,`sys_updated_on`,`url`,`channel_user_profile`,`sys_id`,`route`,`sys_updated_by`,`context_table`,`custom_context`,`sys_created_on`,`experience_name`,`context_id`,`sys_created_by`,`consumer_account_id`) VALUES(0,'2025-06-25 19:16:07','sn_customerservice_case.do?sys_id=<REDACTED sys_id>&sysparm_view=case&sysparm_record_target=sn_customerservice_case&sysparm_record_row=1&sysparm_record_rows=3&sysparm_record_list=<REDACTED EncodedQuery>&sysparm_view=case','<REDACTED sys_id>','<REDACTED sys_id>','record','<REDACTED email>','sn_customerservice_case','{}','2025-06-25 19:16:07','Core UI','<REDACTED sys_id>','<REDACTED email>','<REDACTED sys_id>') /* <REDACTED node>, gs:..., tx:... */
Unique Key violation detected by database ((conn=76771012) Duplicate entry '<REDACTED sys_id>' for key 'channel_user_profile')
: java.sql.SQLIntegrityConstraintViolationException: (conn=76771012) Duplicate entry '<REDACTED sys_id>' for key 'channel_user_profile':

 

I'm attempting a custom fix now, and will report back with any updates from Support or what I was able to do to patch this.

Thank you, @Jordan Blake , for the thorough analysis and for informing us about the fix availability. If possible, could you also share details of the custom fix you're implementing? It would be helpful for us to explore a similar approac

I believe I may have fixed this, and the root cause was a data issue on the "sys_cs_skill_context" and "sys_cs_consumer_account" tables.

I found that records on the "sys_cs_skill_context" table with an empty "consumer_account_id" field are what cause this. New interactions with the Now Assist Panel are properly inserting Skill Contexts with Consumer Accounts, but records which existed previously cause the error because the "consumer_account_id" field is empty.

 

To fix this I cleaned up the Consumer Accounts table to make sure there were no duplicates and the "portal" field was set to the proper Next Experience value, then I updated the Skill Context records to populate the Consumer Account value with the proper relationship per-user.