This PR will fix this bug: fix(Dgraph): fix bug when deleting and adding to a single UID predicate in the same transaction. by martinmr · Pull Request #6431 · dgraph-io/dgraph · GitHub
For now, you can simply add a new value to a single UID predicate (without the delete operation). That logic works fine and it will take care of ensuring only one value is present at the end of the transaction.
It’s probably too late for this fix to be included in the next patch but it should make it into the one after that at the latest.
@myo Thanks for the detailed bug report. It was helpful in identifying the root cause.