I wasted hours on this, you'll get the same error if your SQL expects a UNIQUE INDEX to exist with the same set of columns, but it isn't there for some reason (I think in my case it was messed up migrations in my local dev db).
UNIQUE INDEX