I had a similar issue, but in my case it turned out that I used case insensitive collation - utf8_general_ci
.
Thus, when I tried to insert two strings which were different in a case-sensitive comparison, but the same in the case-insensitive one, MySQL fired the error and I couldn't understand what a problem, because I used a case-sensitive search.
The solution is to change the collation of a table, e.g. I used utf8_bin
which is case-sensitive (or utf8_general_cs
should be appropriate one too).