[As the below Spotify URLs were embedding the tracks/albums into the post and making the post difficult to read, I've replaced the URL with [spotify URL], so anywhere you see this, replace it with open.spotify.com to get the actual link]
I'm developing an application for Spotify library management, and I'm using the API endpoint for retrieving user's saved tracks, testing mainly using my personal Spotify account. I've spotted an error in the API response that is a massive problem for my application: if a song has multiple versions (i.e. same track on multiple albums, greatest hits, etc). Then the API is sometimes returning the wrong version of the track.
One of the track IDs returned was
Here's the link to the track, Sliver by Nirvana [spotify URL]/track/3BtHClmMmURD8UHF2fiyxt which is linking to the 'Incesticide' version of the track. When I open this link in my browser signed in, I can see that neither the song nor the album is 'liked', so I checked in my library and I found that I do have this song liked in another album, their Greatest Hits album [spotify URL]/track/5cKX0mpathSUNNqpHcxOe4 . You'll notice in the URL that this track has a different ID entirely from the version on the album Incesticide, but going through the entire tracklist returned from the API, this ID was not included.
A related issue I found was with the album 'True' by Avicii. The API returned the tracklist from this version of the album [spotify URL]/album/2H6i2CrWgXE1HookLu8Au0 , which again is not saved on my account. But checking my account, I have this version of the album marked as liked [spotify URL]/album/02h9kO2oLKnLtycgbElKsw , which I can't find anywhere on Avicii's main page, its not even the same as the Bonus Edition found here [spotify URL]/album/50oWFJ0mDEeMa74ElsdAp3 . I'm assuming that the version I have liked is an old version that was replaced (checking Available Markets on the API for the version I have liked seems to be blank, which confirms this).
I can see a possible way to work around the the problem with the Avicii album (nevermind, I definitely need a way to get the exact version that's actually saved in the library), but I don't really know what to do with the Nirvana example. If I find any more similar issues, I'll add it to this post.
I've found an song that seems to be an example of both cases: API is linking to the wrong version of the song (different album), as well as the version that is saved in my library not existing publicly: [spotify URL]/track/0b7b3OR4cKHo08rdpLHofM
NodeJS/Windows 10 PC