While running the matter integration a matter was failing constantly.
The client was trying to update the matter details and we are getting an error
Violation of UNIQUE KEY constraint 'FK_project_definition_10'. Cannot insert duplicate key in object 'dbo.project_definition'. The duplicate key value is (1).
On checking the DB we found there are two matters with the same matter number but on different companies and that is the reason why it was failing constantly.
As per the application behavior, if the matter feed file contains two records with the same number if it tries to create a new matter or update the existing matter then we will get a similar error. In this case, we need to reduce the batch size to 1.
We need to delete the matter that is wrongly created and move the matter to the correct company.