Symptoms
Duplicate Key Errors when Deploying using Package and Deployment
Diagnoses
When you keep seeing the following errors during package and deployment your UAT environment which is stopping a number of your views and forms from deploying:
"14332316","2016-05-10 16:16:58","Error","System","2025","InternalMarshalError","SourceCode.Hosting.Server.Runtime.HostServerBroker.InternalMarshal","2025 Error Marshalling SourceCode.Forms.Runtime.ManagementServer.DeployContexts, Error 2601, Level 14, State 1, Procedure aDeploy, Line 879Cannot insert duplicate key row in object 'Form.Event_Design' with unique index 'UX_Form_Event_Design_ID_ContextID'. The duplicate key value is (7a7bd534-bc73-49a7-9bbd-26d71dcf1211, e6265c65-2f78-4ae8-badf-078a703194a6).","","","UAT-K2-APP01:C:Program Files (x86)K2 blackpearlHost ServerBin","14332316","36d1c0bab19b42a58de010465b43d048",""
Resolution
The key reason is due to the unbound rule, removing the unbound rule in the view and then recreating this same rule should resolve the issue.
In most cases this will occur if the package has been deployed already to another environment e.g. from Dev to UAT. If this is the case then you can run into this issue also. To get around this you need to remove the view or form from the target environment and then further try to redeploy the package again, you should see no further errors.