[BUG]: Silent multi-hour hang on HTTP 429 with Retry-After (urllib3 retries bypass Tidekeeper's rate-limit handling)
How do you run Tidekeeper?
Terminal (pip install)
Tidekeeper version
2026.10.17.1
Platform
Arch Linux (CachyOS), Python 3.14.8, requests 2.34.2, urllib3 2.8.0
Steps to reproduce
# Settings: Tidal HiRes client (apiKeyIndex 5), audioQuality Max,
# audioQualityPriority Max,HiFi,High,Normal, multiThread off,
# downloadDelay on, requestIntervalSeconds 3.0, adaptiveRateLimit on
tidekeeper -l playlists.txt # 11 playlists, the first one has 3234 tracks
After roughly 150 playback/manifest lookups (including the lookups done while skipping files that already exist), the process goes completely silent. No output, no log lines, no "Too many requests" message, no CPU usage, no open connections. It stays like that for over an hour. This happened reproducibly on three runs.
Full output / traceback
py-spy dump of the stuck process:
Thread 3317558 (idle)
sleep_for_retry (urllib3/util/retry.py:374)
sleep (urllib3/util/retry.py:395)
urlopen (urllib3/connectionpool.py:972)
send (requests/adapters.py:696)
send (requests/sessions.py:784)
request (requests/sessions.py:651)
get (requests/sessions.py:671)
_getOpenApiTrackManifestOnce (tidal_dl/tidal.py:1338)
_getOpenApiTrackManifest (tidal_dl/tidal.py:1282)
_getOpenApiFlacStreamUrl (tidal_dl/tidal.py:1447)
<lambda> (tidal_dl/tidal.py:1470)
_getAudioStreamUrlForQuality (tidal_dl/tidal.py:1477)
getStreamUrlByPriority (tidal_dl/tidal.py:1690)
_getTrackStream (tidal_dl/download.py:1402)
downloadTrack (tidal_dl/download.py:1467)
downloadTracks (tidal_dl/download.py:1648)
start_playlist (tidal_dl/events.py:143)
start_type (tidal_dl/events.py:194)
start (tidal_dl/events.py:225)
mainCommand (tidal_dl/__init__.py:168)
_main (tidal_dl/__init__.py:262)
main (tidal_dl/__init__.py:227)
<module> (tidekeeper:6)
Anything else?
Cause: the API session mounts HTTPAdapter(pool_connections=8, pool_maxsize=16, max_retries=3) (tidal_dl/tidal.py:178). max_retries=3 becomes Retry(total=3) with urllib3's defaults, and Retry.is_retry() returns True for a 429 that carries a Retry-After header (RETRY_AFTER_STATUS_CODES = {413, 429, 503}, respect_retry_after_header=True). urllib3 then calls time.sleep(Retry-After) inside session.get(). In urllib3 2.x that sleep is only capped by DEFAULT_RETRY_AFTER_MAX = 21600 seconds, so one request can block for up to 6 hours per retry, 3 times over.
This contradicts the comment right above the adapter ("HTTP status handling (401/404/429) stays in the request helpers"): the 429 never reaches Tidekeeper's own handling (_backOffForRateLimit, the 90 s wait budget, the "Too many requests, automatically waiting ..." message, and the adaptive limiter penalty). So the documented behavior around 429s does not apply to this path, the wait is invisible, and the user cannot tell a hang from a rate limit. The same adapter is used for the catalog and playback calls, so they are affected too whenever TIDAL sends Retry-After.
Suggested fix: let Tidekeeper see the 429 itself, for example:
from urllib3.util.retry import Retry
retries = Retry(total=3, respect_retry_after_header=False)
adapter = requests.adapters.HTTPAdapter(pool_connections=8, pool_maxsize=16, max_retries=retries)
or Retry(total=3, status=0) / max_retries=Retry(3, respect_retry_after_header=False) so connection-level retries stay but 429/503 are returned to _getOnce / _getOpenApiTrackManifestOnce, which already parse Retry-After with a cap (http.retry_delay, cap 300) and print a message. If very long Retry-After values from TIDAL are expected, it would also help to print the wait time before sleeping (e.g. "TIDAL asked to wait 3600 s, resuming at 18:35").
Side note: resuming a large playlist re-requests a manifest for every already downloaded track during the skip check, so each restart spends a large part of the OpenAPI quota before any new track is downloaded. On a 150-track resume that alone was enough to trigger the long block again. Skipping files that have a valid .tidekeeper.json receipt without a manifest lookup would avoid that.
Hey Oliver, thanks for the report, and for tracking it all the way down to the urllib3 retries! Fixed in v2026.10.29.0: https://github.com/OpenNerdz/tidekeeper/releases/tag/v2026.10.29.0
- 429s and 503s now always reach Tidekeeper's own handling, so a rate limit can't turn into a silent hang anymore. Short waits work as before. When TIDAL asks for a longer break, Tidekeeper pauses and tells you when it will carry on (e.g.
Waiting until 18:35), and you can cancel if you'd rather stop. - Your side note is in too: tracks that are already downloaded are now skipped without a manifest lookup, so resuming a big playlist no longer uses up the request limit before it gets to new tracks. Files downloaded with older versions pick this up after one more run.
Update with python -m pip install -U tidekeeper. Let me know if it still stalls on your playlists!