If you have two folders, and give them both the same name, they
This is a long known issue. Folder name have to be unique. I wish I fixed this a long time ago but now we’re way too far down to fix it. All third party apps would break.
Could you forbid the create/rename to a duplicate, at least?
I don’t know how well various third party clients would handle the API call failing, but just having the web app / official client not allow the situation in the first place would be probably good-enough.