[GH-ISSUE #31] Playlist 404 error at launch #20

Closed
opened 2026-02-27 20:07:43 +03:00 by kerem · 6 comments
Owner

Originally created by @tomballgithub on GitHub (Dec 26, 2025).
Original GitHub issue: https://github.com/misiektoja/spotify_monitor/issues/31

I am seeing this when launching one of my 2 instances.

* Error, retrying in 3 minutes: 404 Client Error: Not Found for url: https://api.spotify.com/v1/playlists/37i9dQZF1DWTkxQvqMy4WW?fields=name,owner,followers,external_urls

And then it just hangs up and doesn't proceed to continue to launch the script.

You can simulate by editing this in spotify_get_playlist_info():

    # playlist_id = playlist_uri.split(':', 2)[2]
    playlist_id = "37i9dQZF1DWTkxQvqMy4WW"
Originally created by @tomballgithub on GitHub (Dec 26, 2025). Original GitHub issue: https://github.com/misiektoja/spotify_monitor/issues/31 I am seeing this when launching one of my 2 instances. `* Error, retrying in 3 minutes: 404 Client Error: Not Found for url: https://api.spotify.com/v1/playlists/37i9dQZF1DWTkxQvqMy4WW?fields=name,owner,followers,external_urls` And then it just hangs up and doesn't proceed to continue to launch the script. You can simulate by editing this in spotify_get_playlist_info(): ``` # playlist_id = playlist_uri.split(':', 2)[2] playlist_id = "37i9dQZF1DWTkxQvqMy4WW" ```
kerem closed this issue 2026-02-27 20:07:44 +03:00
Author
Owner

@tomballgithub commented on GitHub (Dec 26, 2025):

This routine is being called when this happens:

def spotify_get_playlist_info(access_token, playlist_uri, oauth_app=False):
    if not access_token:
        raise Exception("spotify_get_playlist_info(): access_token is empty")

    playlist_id = playlist_uri.split(':', 2)[2]
    url = f"https://api.spotify.com/v1/playlists/{playlist_id}?fields=name,owner,followers,external_urls"
 

Here is the request:

GET /v1/playlists/37i9dQZF1DWTkxQvqMy4WW?fields=name,owner,followers,external_urls HTTP/1.1
Host: api.spotify.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/603.3.10 (KHTML, like Gecko) Version/15.0 Safari/603.3.10
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Authorization: Bearer XXX

Response:

HTTP/1.1 404 Not Found
content-type: application/json; charset=utf-8
cache-control: private, max-age=0
access-control-allow-origin: *
access-control-allow-headers: Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version, X-Cloud-Trace-Context, client-token, content-access-token
access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE, PATCH
access-control-allow-credentials: true
access-control-max-age: 604800
content-encoding: gzip
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
date: Fri, 26 Dec 2025 05:40:06 GMT
server: envoy
via: HTTP/2 edgeproxy, 1.1 google
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Transfer-Encoding: chunked

{
  "error": {
    "status": 404,
    "message": "Resource not found"
  }
}
<!-- gh-comment-id:3692189129 --> @tomballgithub commented on GitHub (Dec 26, 2025): This routine is being called when this happens: ``` def spotify_get_playlist_info(access_token, playlist_uri, oauth_app=False): if not access_token: raise Exception("spotify_get_playlist_info(): access_token is empty") playlist_id = playlist_uri.split(':', 2)[2] url = f"https://api.spotify.com/v1/playlists/{playlist_id}?fields=name,owner,followers,external_urls" ``` Here is the request: ``` GET /v1/playlists/37i9dQZF1DWTkxQvqMy4WW?fields=name,owner,followers,external_urls HTTP/1.1 Host: api.spotify.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/603.3.10 (KHTML, like Gecko) Version/15.0 Safari/603.3.10 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Authorization: Bearer XXX ``` Response: ``` HTTP/1.1 404 Not Found content-type: application/json; charset=utf-8 cache-control: private, max-age=0 access-control-allow-origin: * access-control-allow-headers: Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version, X-Cloud-Trace-Context, client-token, content-access-token access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE, PATCH access-control-allow-credentials: true access-control-max-age: 604800 content-encoding: gzip strict-transport-security: max-age=31536000 x-content-type-options: nosniff alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 date: Fri, 26 Dec 2025 05:40:06 GMT server: envoy via: HTTP/2 edgeproxy, 1.1 google Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Transfer-Encoding: chunked { "error": { "status": 404, "message": "Resource not found" } } ```
Author
Owner

@tomballgithub commented on GitHub (Dec 26, 2025):

So I verified this doesn't always happen, but it does consistently happen with this playlist, which is one of these public Spotify curated lists. It was the last playlist I had listened to at the time.

It's a valid playlist:
https://open.spotify.com/playlist/37i9dQZF1DWTkxQvqMy4WW

<!-- gh-comment-id:3693183960 --> @tomballgithub commented on GitHub (Dec 26, 2025): So I verified this doesn't always happen, but it does consistently happen with this playlist, which is one of these public Spotify curated lists. It was the last playlist I had listened to at the time. It's a valid playlist: https://open.spotify.com/playlist/37i9dQZF1DWTkxQvqMy4WW
Author
Owner

@tomballgithub commented on GitHub (Dec 26, 2025):

What's weird is using the official API page, https://developer.spotify.com/documentation/web-api/reference/get-playlist, any public Spotify curated lists also generates a 404 error.

Just go here and pick any one:
https://open.spotify.com/user/spotify

In absence of a fix, just need to trap the error

<!-- gh-comment-id:3693197343 --> @tomballgithub commented on GitHub (Dec 26, 2025): What's weird is using the official API page, https://developer.spotify.com/documentation/web-api/reference/get-playlist, any public Spotify curated lists also generates a 404 error. Just go here and pick any one: https://open.spotify.com/user/spotify In absence of a fix, just need to trap the error
Author
Owner

@tomballgithub commented on GitHub (Dec 26, 2025):

Here is why this is happening with those playlists.
https://community.spotify.com/t5/Spotify-for-Developers/404-Resource-not-found-for-Playlists-by-Spotify/td-p/6552598

<!-- gh-comment-id:3693212343 --> @tomballgithub commented on GitHub (Dec 26, 2025): Here is why this is happening with those playlists. https://community.spotify.com/t5/Spotify-for-Developers/404-Resource-not-found-for-Playlists-by-Spotify/td-p/6552598
Author
Owner

@tomballgithub commented on GitHub (Dec 26, 2025):

I thought a fix for spotify_get_playlist_info() is to add a 404 check:

    try:
        response = SESSION.get(url, headers=headers, timeout=FUNCTION_TIMEOUT, verify=VERIFY_SSL)
        if response.status_code == 404:
            return False
        response.raise_for_status()

However, that forces is_playlist to False, which may have other side effects.

<!-- gh-comment-id:3693221802 --> @tomballgithub commented on GitHub (Dec 26, 2025): I thought a fix for spotify_get_playlist_info() is to add a 404 check: ``` try: response = SESSION.get(url, headers=headers, timeout=FUNCTION_TIMEOUT, verify=VERIFY_SSL) if response.status_code == 404: return False response.raise_for_status() ``` However, that forces is_playlist to False, which may have other side effects.
Author
Owner

@misiektoja commented on GitHub (Dec 27, 2025):

Yes, I confirm that oauth_app can't be used to get info for Spotify-generated playlists (known limitation as you pasted).

However, I realized we don't really need that function since everything is actually returned in the friend activity API response. I'm not even sure why I put that function in there in the first place. It was such a long time ago. Anyway, it works as expected now.

<!-- gh-comment-id:3693533747 --> @misiektoja commented on GitHub (Dec 27, 2025): Yes, I confirm that oauth_app can't be used to get info for Spotify-generated playlists (known limitation as you pasted). However, I realized we don't really need that function since everything is actually returned in the friend activity API response. I'm not even sure why I put that function in there in the first place. It was such a long time ago. Anyway, it works as expected now.
Sign in to join this conversation.
No labels
Stale
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify_monitor#20
No description provided.