That looks like a call using the Tweepy library. Are you sure it’s not an issue in the Python code? I just tried the following:
twurl "/1.1/friends/ids.json?screen_name=canonind&count=5000" > friends.json
- edit and sort
friends.json
- no duplicate entries
If you’re able to reproduce in some other way so we can narrow this down to an API issue vs. a library or code problem, I’m happy to look at it further.