This error is quite easy to reproduce (if someone is interested just add a comment and I can send you the project)
Create an entity A with a integer attribute B and set the unique constraint on attribute B. In a microflow make sure that you create multiple entity A objects with the same value for attribute B. Do not commit the objects, but after the create add the objects to a list of entity A objects. Then perform a commit object(s) action on the list. Then if you created 2 object of entity A with the value 10 for attribute B, the result will be that there are 2 objects saved to the database with the same value for attribute B, thereby violating the unique constraint.
This was tested in version 4.3.2 with the builtin db and is a bug IMHO.
Also tested the issue in Mx 5.18 and in this version the issue has been resolved. On the commit action of the list the unique constraint is honored correctly.
Have you applied the unique constraint after there were already records in the database? Constraints don't work retroactively so if there already were records with duplicate values, they will remain there.