Hi Arpit,
This error message can appear when an agent with the same name already exists in the ICM database.
One solution is that you add the new agent to the ICM with a different name.
Alternatively, you can delete the existing agent. When you delete an agent, it is logically marked for deletion, but continues to exist in the database with the Deleted flag set to Y (yes). It is no longer available for use in the routing scripts. However, you will still be unable to create a new agent with the same name as that of the deleted agent, because it still exists in the database. In order to delete the agent record permanently, select Configuration Manager > Administration > Deleted Objects, and delete it.
Refer to Failure to Add a New Agent to Cisco ICM - Violation of UNIQUE KEY Constraint for more information. Also refer UCCE 7.x: Error Message "Failed to update the database" When Trying to Delete an Agent.
Regards,
Greeshma