I've noticed that there is an ongoing bug for the recently played tracks endpoint in which the currently listening song, once done listening to, gets added at least twice when I change my device I am listening Spotify on.
Once the song is done playing, Spotify adds the same track twice to the play history. I assume the bug is that your API doesn't account for multiple active devices when playing a song when it marks a song as played. Somewhere in your logic, when you switch the current device you're lsitening to, it never turns it off for the prior device. So, when I switch the playback from my phone to web client, it still acts as if I'm listening on my phone and adds the track as a duplicate in my play history.
Also, I don't think this is a minor bug to brush off. I'm sure a good sourcec of revenue is from third-parties y'all sell user data such as history of songs played and other data that relies on it such as preferred genre, songs, etc. Currently, and in the future if this bug isn't patched, you are and would be continuing to sell to those third-parties inaccurate user data. I'm sure they wouldn't want to pay top-dollar for inaccurate user data that will mislead them to target the wrong consumers.
As you can see from this image from a call to get-recently-played endpoint, the same song was added twice. Same track at nearly the same time, off by a few milliseconds.