mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-26 23:45:49 +03:00
[GH-ISSUE #271] SpotifyWebAPIException: Missing or bad version tag #197
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#197
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kasperkamperman on GitHub (Feb 29, 2024).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/271
I suddenly get an error when I'm deleting tracks. I didn't change any code or updated anything.
Which makes me assume something changes on the side of Spotify (couldn't find announcements though).
I delete tracks based on the positions:
I was checking the Spotify API documentation and this way of deleting is not documented (anymore):
https://developer.spotify.com/documentation/web-api/reference/remove-tracks-playlist
I looked quickly and it seems you didn't build anything to convert positions to spotify uri's. So, that might indeed indicate that there was a silent Spotify API change that remove this function?
@jwilsson commented on GitHub (Feb 29, 2024):
Hey!
That's strange. It does sound like passing
positionswas removed from the Spotify docs at some point. But this code (copied from the tests added 6 years ago works 😅):@kasperkamperman commented on GitHub (Feb 29, 2024):
I noticed it works again somehow. Will try if it keeps like this and share my findings.
@kasperkamperman commented on GitHub (Mar 13, 2024):
It worked for a week, now again Spotify refuses to delete songs.
I get the error:
Missing or bad version tagI tried removing the snapShotID but that results in:
Must specify snapshot_id when setting positions/nMy assumption is that the positions part is removed or not stable. It's a pity. Because now I have to give track id's, however that would remove probably duplicates too (which I don't want).
@kasperkamperman commented on GitHub (Mar 13, 2024):
It seems that I have the same issues calling a supported (at last api documentation) way. Like passing track id's.
Same error: Missing or bad version tag.
It might be an issue with the snapshotID then, which I get from a previous call to addPlaylistTracks.
@kasperkamperman commented on GitHub (Mar 13, 2024):
I'm testing in the API console and there it still seems to work.
What I noticed. I get a snapshotId when I call
addPlaylistTracks.This snapshotId is the one I use to pass to
deletePlaylistTracks($destinationId, $positionsToRemove, $snapShotId).I could get a recent snapshotId in the api console by calling:
This works in this PHP api too:
What I noticed it that the snapshotId I got back from addPlaylistTracks is really shorter then the one I got from deletePlaylistTracks. This happens in this PHP code as well as in the Spotify console.
So my current working workaround is:
@jwilsson commented on GitHub (Mar 14, 2024):
I saw you're active in the thread on Spotify's forums. That was going to be my suggestion, to reach out there. But like you're saying there, it's really worrisome that the APIs change without any communication.
@vorce commented on GitHub (Mar 21, 2024):
Also having this problem with my little app (which has been working fine for years until lately), it uses the web api in this way:
Haven't tried your workaround yet @kasperkamperman, but will do that.
@JMPerez commented on GitHub (May 2, 2024):
Adding another issue that I'm finding here in case you are trying to remove tracks at a specific position. I confirm that Spotify ends up removing all appearances of the track in the playlist and the positions are ignored. This is bad when trying to remove duplicates, as there is no way to leave one instance of the track.
@kasperkamperman commented on GitHub (Nov 2, 2024):
@JMPerez I was reading your blog on this issue. You mentioned
I actually was using this way of removing tracks. Just by using positions, but I found it was broken when I wrote this issue.
Are you actually using this way now in your Dedup tool and is it working stable?
My way of removing positions:
@kasperkamperman commented on GitHub (Nov 23, 2024):
I tested it again, but it doesn't seem to work anymore. I get the error message:
@jwilsson commented on GitHub (Nov 28, 2024):
Okay, this is really strange. I just tried deleting both by URI and position and both worked 🤔
It's a playlist I just created, don't know if that matters. The only scope I have granted is "playlist-modify-private".
@kasperkamperman commented on GitHub (Dec 1, 2024):
Thanks @jwilsson for testing. I did another test myself.
I seems that my workaround (see earlier comments in this topic) for the invalid snapshot id threw this error:
$new_id = $api->deletePlaylistTracks($destinationId, ['tracks' => []]);I can confirm that removal of positions works again now.
Fingers crossed, because it's undocumented in the API.
@jwilsson commented on GitHub (Feb 19, 2026):
Just want to give a heads up, in the latest version
7.1.0,SpotifyWebAPI::deletePlaylistTracks()has been deprecated due to the February 2026 changes and replaced withSpotifyWebAPI::deletePlaylistItems(). It looks likepositionsis supported by the new endpoint but it's not documented.I've not yet decided on when (or if) the deprecated method will be removed or if I'll support
positionsin the new method given it's undocumented but I wanted to bring your attention to it.