I’ve done some further investigation. I wrote a script to call the /nft/{address}/owners endpoint recursively decrementing the offset by 500 until it reaches 0 and store locally each record, along with the offset position for each record.
On the first run through, I found approx 153 duplicate entries out of the 105347 entries for the given contract.
I truncated my local db and tried again and found different duplicates than the first time. Here’s an example of the tokens and the corresponding offset position the entry was found at.
TokenID Offset
29297 55847
29297 55347
42063 54347
42063 53847
31523 54347
31523 53847
I then ran a single api call on those specific offset positions. Here was the result:
29297 55847 -> not found
29297 55347 -> found
42063 54347 -> not found
42063 53847 -> found
31523 54347 -> not found
31523 53847 -> found
My conclusion, along with your checking from earlier is that these duplicates do not exist in your table but are possibly being fed by whatever mechanism you have in place feeding the api results. I believe my server received responses with those token id’s matching those offset positions.
If the data processing error (call or insert) was on my side, I would expect a more uniform set of errors. These duplicates appear to occur randomly and to come from the server (moralis).
I’ll continue to investigate on my side and keep you updated on any new tests or findings. …an ‘order by’ param on this endpoint would make debugging much easier.
Also, I decrement the offset because it appears that the higher the offset number, the older the result set. Pulling the oldest first allows for a cleaner delta going forward after the initial sync.