[GH-ISSUE #1093] Get HTTP 429 and error Max Retries, reason: too many 500 error responses when trying to fetch saved tracks. #650

Closed
opened 2026-02-28 00:00:32 +03:00 by kerem · 9 comments
Owner

Originally created by @K4LCIFER on GitHub (Apr 30, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1093

I have something similar to the following:

import spotipy
from spotipy.oauth2 import SpotifyOAuth

scope = "user-library-read user-read-recently-played"

sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="<client-id>", client_secret="<client-secret>", redirect_uri="http://localhost/", scope=scope))

print(sp.current_user_saved_tracks(market="US", limit=1))

But running this results in the following error

spotipy.exceptions.SpotifyException: http status: 429, code:-1 - /v1/me/tracks?limit=1&offset=0&market=US:
 Max Retries, reason: too many 500 error responses

This might be an error on Spotify's end, because, in the Spotify Web API docs, their API tester also errors out when attempting a similar request. Perhaps #1024 is related (I also have a lot of songs — approximately 40k)?

Originally created by @K4LCIFER on GitHub (Apr 30, 2024). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1093 <!--- Please make sure you've: - read the FAQ https://github.com/plamere/spotipy/blob/master/FAQ.md - read the documentation https://spotipy.readthedocs.io/en/latest/ - searched older issues If your question is about code, please share the code you are using ---> I have something similar to the following: ```python import spotipy from spotipy.oauth2 import SpotifyOAuth scope = "user-library-read user-read-recently-played" sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="<client-id>", client_secret="<client-secret>", redirect_uri="http://localhost/", scope=scope)) print(sp.current_user_saved_tracks(market="US", limit=1)) ``` But running this results in the following error ``` spotipy.exceptions.SpotifyException: http status: 429, code:-1 - /v1/me/tracks?limit=1&offset=0&market=US: Max Retries, reason: too many 500 error responses ``` This might be an error on Spotify's end, because, in the Spotify Web API docs, their API tester also errors out when attempting a similar request. Perhaps #1024 is related (I also have a lot of songs — approximately 40k)?
kerem 2026-02-28 00:00:32 +03:00
Author
Owner

@dieser-niko commented on GitHub (Apr 30, 2024):

You could try posting to the Spotify Community forum with the same question.

Your script seems to be fine, and you said yourself that it wasn't working in the documentation, which suggests that this is not a problem with spotipy.

<!-- gh-comment-id:2085421156 --> @dieser-niko commented on GitHub (Apr 30, 2024): You could try posting to the [Spotify Community](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer) forum with the same question. Your script seems to be fine, and you said yourself that it wasn't working in the documentation, which suggests that this is not a problem with spotipy.
Author
Owner

@K4LCIFER commented on GitHub (May 2, 2024):

You could try posting to the Spotify Community forum with the same question.

I have, but, unfortunately, the post never received a response. I have emailed Spotify's support back and forth, a few times, but I've yet to find a solution.

<!-- gh-comment-id:2089563831 --> @K4LCIFER commented on GitHub (May 2, 2024): > You could try posting to the [Spotify Community](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer) forum with the same question. [I have](https://community.spotify.com/t5/Spotify-for-Developers/Error-code-500-when-trying-to-retrieve-a-song-from-library/td-p/5867532), but, unfortunately, the post never received a response. I have emailed Spotify's support back and forth, a few times, but I've yet to find a solution.
Author
Owner

@dieser-niko commented on GitHub (May 3, 2024):

That doesn't sound promising. I'll leave this issue open, even though this problem is not caused by spotipy. If there are any updates, please post them here.

I've also been experimenting a bit myself. First I created a playlist, because it's much easier to fill a playlist with a bunch of songs. Got up to 11,000, but no errors yet. Then I used my second account and around the 24,000 mark I got a code 500 with a "server error" message. So only partially reproducible, as I didn't get the same error you did.
Not sure why I did this because it was clear to me that I couldn't fix anything about it, but yeah.. At least partially reproducible.

<!-- gh-comment-id:2092702059 --> @dieser-niko commented on GitHub (May 3, 2024): That doesn't sound promising. I'll leave this issue open, even though this problem is not caused by spotipy. If there are any updates, please post them here. I've also been experimenting a bit myself. First I created a playlist, because it's much easier to fill a playlist with a bunch of songs. Got up to 11,000, but no errors yet. Then I used my second account and around the 24,000 mark I got a code 500 with a "server error" message. So only partially reproducible, as I didn't get the same error you did. Not sure why I did this because it was clear to me that I couldn't fix anything about it, but yeah.. At least partially reproducible.
Author
Owner

@dieser-niko commented on GitHub (May 9, 2024):

Uhm.. no. There may be an internal rate limit, but it has nothing to do with the rate limit the documentation is talking about.
In this case it is not the application's fault.

I have already made sure that this is not a typical bug. Next time please read the comments.

<!-- gh-comment-id:2103103930 --> @dieser-niko commented on GitHub (May 9, 2024): Uhm.. no. There may be an internal rate limit, but it has nothing to do with the rate limit the documentation is talking about. In this case it is not the application's fault. I have already made sure that this is not a typical bug. Next time please read the comments.
Author
Owner

@dieser-niko commented on GitHub (Jun 4, 2024):

I was bored and poked around in the Web API documentation and found that the request goes through sometimes. So I guess a possible workaround would be to send multiple requests until you get a valid answer.

<!-- gh-comment-id:2147265019 --> @dieser-niko commented on GitHub (Jun 4, 2024): I was bored and poked around in the Web API documentation and found that the request goes through *sometimes*. So I guess a possible workaround would be to send multiple requests until you get a valid answer.
Author
Owner

@dieser-niko commented on GitHub (Jun 4, 2024):

@K4LCIFER Can you check if this is the same for you? You got a different error than I did, so I'm not 100% sure if this applies to you.

<!-- gh-comment-id:2147267597 --> @dieser-niko commented on GitHub (Jun 4, 2024): @K4LCIFER Can you check if this is the same for you? You got a different error than I did, so I'm not 100% sure if this applies to you.
Author
Owner

@K4LCIFER commented on GitHub (Jun 4, 2024):

I tried it two ways: I ran the python script, which utilized spotipy, multiple times, and I tried the Spotify Web API documentation's API tester thing multiple times. In both cases I sent the request 30ish times, but they all responded with error 500.

<!-- gh-comment-id:2148517661 --> @K4LCIFER commented on GitHub (Jun 4, 2024): I tried it two ways: I ran the python script, which utilized spotipy, multiple times, and I tried the Spotify Web API documentation's API tester thing multiple times. In both cases I sent the request 30ish times, but they all responded with error 500.
Author
Owner

@dieser-niko commented on GitHub (Jun 5, 2024):

So it seems that the number of retries (default args) varies. First I only had to do 5, then 8, then 30, then 2, then 6.

Maybe you were unlucky, or maybe the extra 15k songs in your library are causing even more problems.

<!-- gh-comment-id:2149041633 --> @dieser-niko commented on GitHub (Jun 5, 2024): So it seems that the number of retries (default args) varies. First I only had to do 5, then 8, then 30, then 2, then 6. Maybe you were unlucky, or maybe the extra 15k songs in your library are causing even more problems.
Author
Owner

@dieser-niko commented on GitHub (Aug 5, 2024):

I'm going to close the issue as Spotify doesn't seem to be doing anything about it. However, I have noticed on my alt account that I can no longer access my liked songs in the app, so maybe if you ask Spotify support they will do something about this and fix the API along the way. Maybe..

<!-- gh-comment-id:2268883479 --> @dieser-niko commented on GitHub (Aug 5, 2024): I'm going to close the issue as Spotify doesn't seem to be doing anything about it. However, I have noticed on my alt account that I can no longer access my liked songs in the app, so maybe if you ask Spotify support they will do something about this and fix the API along the way. Maybe..
Sign in to join this conversation.
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/spotipy#650
No description provided.