As that's quite a complicated function, I would start by getting the exact SQL that was executed and see what it looks at. As all the fields come from the 'user' table then having a duplicate id value seems very odd. You may want to check that table and make sure it is properly indexed. The id field should be unique.
...the easiest thing is to enable it just before the offending database call.