[GH-ISSUE #56] [Bug Report] AttributeError on Login5 Token (as None) After Expiry #46

Closed
opened 2026-02-27 04:57:16 +03:00 by kerem · 8 comments
Owner

Originally created by @ulyxie on GitHub (Aug 19, 2025).
Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/56

Originally assigned to: @Googolplexed0 on GitHub.

Bug Description
After a while of downloading my long playlists, it crashes with AttributeError: 'NoneType' object has no attribute 'access_token'. From starting Zotify via the command, it took roughly 3703 seconds (or slightly more than an hour and one minute) before it crashed on the AttributeError.

Bug Triggering Command

zotify \
  --download-lyrics=true \
  --download-format=mp3 \
  --download-quality=very_high \
  -rp . \
  -ie True \
  --md-allgenres True \
  --retry-attempts 5 \
  --bulk-wait-time=10 \
  -rt True \
  -f songs.txt

songs.txt contains about 13 playlists, some having upwards of 600 songs. This is being downloaded in real time.

Error Traceback / Logs
zotify_DEBUG_2025-08-18_15-12-24.log

Traceback:

###   ERROR:  SKIPPING SONG - FAILED TO QUERY METADATA   ###
###   Track_ID: 3u7cP7EJnzjTAT6XtexKNV   ###

######################################################################################################################
{ 'playlist': 'My Playlist #56',
  'playlist_id': '4jO0g8ouJQtTTdpoe6YlPK',
  'playlist_num': '001',
  'playlist_track': 'Unlimited Power',
  'playlist_track_id': '3u7cP7EJnzjTAT6XtexKNV'}
######################################################################################################################

Traceback (most recent call last):
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/track.py", line 207, in download_track
    track_metadata = get_track_metadata(track_id)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/track.py", line 53, in get_track_metadata
    (raw, info) = Zotify.invoke_url(f'{TRACK_URL}?ids={track_id}&market=from_token')
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 646, in invoke_url
    headers = cls.get_auth_header()
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 637, in get_auth_header
    'Authorization': f'Bearer {cls.__get_auth_token()}',
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 632, in __get_auth_token
    ).access_token
      ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'access_token'
                                                                                                                      Traceback (most recent call last):
  File "/home/helio/.local/bin/zotify", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/__main__.py", line 119, in main
    args.func(args)
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 245, in client
    download_from_urls(urls)
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 37, in download_from_urls
    NAME: get_playlist_info(playlist_id)[0]},
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/playlist.py", line 35, in get_playlist_info
    (raw, resp) = Zotify.invoke_url(f'{PLAYLIST_URL}/{playlist_id}?fields=name,owner(display_name)&market=from_token')
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 646, in invoke_url
    headers = cls.get_auth_header()
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 637, in get_auth_header
    'Authorization': f'Bearer {cls.__get_auth_token()}',
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 632, in __get_auth_token
    ).access_token
      ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'access_token

Config File
config_DEBUG.json

Zotify Version
v0.9.22

Additional Context
linking my original reply to a different issue.
https://github.com/Googolplexed0/zotify/issues/48#issuecomment-3197675288

Originally created by @ulyxie on GitHub (Aug 19, 2025). Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/56 Originally assigned to: @Googolplexed0 on GitHub. **Bug Description** After a while of downloading my long playlists, it crashes with `AttributeError: 'NoneType' object has no attribute 'access_token'`. From starting Zotify via the command, it took roughly 3703 seconds (or slightly more than an hour and one minute) before it crashed on the AttributeError. **Bug Triggering Command** ```bash zotify \ --download-lyrics=true \ --download-format=mp3 \ --download-quality=very_high \ -rp . \ -ie True \ --md-allgenres True \ --retry-attempts 5 \ --bulk-wait-time=10 \ -rt True \ -f songs.txt ``` songs.txt contains about 13 playlists, some having upwards of 600 songs. This is being downloaded in real time. **Error Traceback / Logs** [zotify_DEBUG_2025-08-18_15-12-24.log](https://github.com/user-attachments/files/21848893/zotify_DEBUG_2025-08-18_15-12-24.log) Traceback: ``` ### ERROR: SKIPPING SONG - FAILED TO QUERY METADATA ### ### Track_ID: 3u7cP7EJnzjTAT6XtexKNV ### ###################################################################################################################### { 'playlist': 'My Playlist #56', 'playlist_id': '4jO0g8ouJQtTTdpoe6YlPK', 'playlist_num': '001', 'playlist_track': 'Unlimited Power', 'playlist_track_id': '3u7cP7EJnzjTAT6XtexKNV'} ###################################################################################################################### Traceback (most recent call last): File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/track.py", line 207, in download_track track_metadata = get_track_metadata(track_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/track.py", line 53, in get_track_metadata (raw, info) = Zotify.invoke_url(f'{TRACK_URL}?ids={track_id}&market=from_token') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 646, in invoke_url headers = cls.get_auth_header() ^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 637, in get_auth_header 'Authorization': f'Bearer {cls.__get_auth_token()}', ^^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 632, in __get_auth_token ).access_token ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'access_token' Traceback (most recent call last): File "/home/helio/.local/bin/zotify", line 7, in <module> sys.exit(main()) ^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/__main__.py", line 119, in main args.func(args) File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 245, in client download_from_urls(urls) File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/app.py", line 37, in download_from_urls NAME: get_playlist_info(playlist_id)[0]}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/playlist.py", line 35, in get_playlist_info (raw, resp) = Zotify.invoke_url(f'{PLAYLIST_URL}/{playlist_id}?fields=name,owner(display_name)&market=from_token') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 646, in invoke_url headers = cls.get_auth_header() ^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 637, in get_auth_header 'Authorization': f'Bearer {cls.__get_auth_token()}', ^^^^^^^^^^^^^^^^^^^^^^ File "/home/helio/.local/pipx/venvs/zotify/lib/python3.11/site-packages/zotify/config.py", line 632, in __get_auth_token ).access_token ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'access_token ``` **Config File** [config_DEBUG.json](https://github.com/user-attachments/files/21848892/config_DEBUG.json) **Zotify Version** v0.9.22 **Additional Context** linking my original reply to a different issue. https://github.com/Googolplexed0/zotify/issues/48#issuecomment-3197675288
kerem 2026-02-27 04:57:16 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@TNAS123 commented on GitHub (Aug 19, 2025):

this is what I was seeing too.

At the moment I have downgraded to v0.9.10 for more reliability.

<!-- gh-comment-id:3201569550 --> @TNAS123 commented on GitHub (Aug 19, 2025): this is what I was seeing too. At the moment I have downgraded to v0.9.10 for more reliability.
Author
Owner

@Googolplexed0 commented on GitHub (Aug 21, 2025):

At the moment I have downgraded to v0.9.10 for more reliability.

I am 99% sure this error is caused by the upstream librespot-python library, which means downgrading this library should have no effect. If downgrading actually does solve this, I would be extremely surprised. Working on a simple fix for this upstream.

<!-- gh-comment-id:3208780410 --> @Googolplexed0 commented on GitHub (Aug 21, 2025): > At the moment I have downgraded to v0.9.10 for more reliability. I am 99% sure this error is caused by the upstream [librespot-python](https://github.com/kokarare1212/librespot-python) library, which means downgrading this library _should_ have no effect. If downgrading actually does solve this, I would be extremely surprised. Working on a simple fix for this upstream.
Author
Owner

@Googolplexed0 commented on GitHub (Aug 21, 2025):

@ulyxie See if updating to v0.9.25, which uses a new (much cleaner) patch of the upstream library, fixes this. If so, I will push the improvement upstream.

<!-- gh-comment-id:3208890261 --> @Googolplexed0 commented on GitHub (Aug 21, 2025): @ulyxie See if updating to v0.9.25, which uses a new (much cleaner) patch of the upstream library, fixes this. If so, I will push the improvement upstream.
Author
Owner

@ulyxie commented on GitHub (Aug 21, 2025):

@ulyxie See if updating to v0.9.25, which uses a new (much cleaner) patch of the upstream library, fixes this. If so, I will push the improvement upstream.

I updated and started the run. I will report when it concludes but it will take a few hours if it is indeed fixed.

<!-- gh-comment-id:3209064977 --> @ulyxie commented on GitHub (Aug 21, 2025): > [@ulyxie](https://github.com/ulyxie) See if updating to v0.9.25, which uses a new (much cleaner) patch of the upstream library, fixes this. If so, I will push the improvement upstream. I updated and started the run. I will report when it concludes but it will take a few hours if it is indeed fixed.
Author
Owner

@ulyxie commented on GitHub (Aug 21, 2025):

TL;DR: it appears to be fixed now, only time will tell.

So the command is still running. About 2 hours after I wrote my previous comment, it crashed on some File exception so I reran the command with debug flag enabled. Since then it has been running happily with no issue. I will keep monitoring in case something else breaks and will trim the debug log so it's not this long. If the file exception happens again, I will create a new bug report. Sorry Googolplexed0 for being such a demanding user.

<!-- gh-comment-id:3210594624 --> @ulyxie commented on GitHub (Aug 21, 2025): TL;DR: it appears to be fixed now, only time will tell. So the command is still running. About 2 hours after I wrote my previous comment, it crashed on some File exception so I reran the command with debug flag enabled. Since then it has been running happily with no issue. I will keep monitoring in case something else breaks and will trim the debug log so it's not this long. If the file exception happens again, I will create a new bug report. Sorry Googolplexed0 for being such a demanding user.
Author
Owner

@Googolplexed0 commented on GitHub (Aug 21, 2025):

About 2 hours after I wrote my previous comment

Beating the previous 1 hour limit is a good sign!

Sorry Googolplexed0 for being such a demanding user.

I don't think that at all, I want to help you and make this library better. Thank you for appreciating my work.

<!-- gh-comment-id:3210647431 --> @Googolplexed0 commented on GitHub (Aug 21, 2025): > About 2 hours after I wrote my previous comment Beating the previous 1 hour limit is a good sign! > Sorry Googolplexed0 for being such a demanding user. I don't think that at all, I want to help you and make this library better. Thank you for appreciating my work.
Author
Owner

@ulyxie commented on GitHub (Aug 22, 2025):

Update on this issue. After 27 hours no exception related to this was thrown. Bad file descriptor was the exception that was thrown so I will make a new issue.

<!-- gh-comment-id:3214082537 --> @ulyxie commented on GitHub (Aug 22, 2025): Update on this issue. After 27 hours no exception related to this was thrown. Bad file descriptor was the exception that was thrown so I will make a new issue.
Author
Owner

@RGPZ commented on GitHub (Aug 31, 2025):

@ulyxie See if updating to v0.9.25, which uses a new (much cleaner) patch of the upstream library, fixes this. If so, I will push the improvement upstream.

What if I still receive this exact issue even on the latest version?
Traceback (most recent call last): File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 207, in download_track track_metadata = get_track_metadata(track_id) File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 53, in get_track_metadata (raw, info) = Zotify.invoke_url(f'{TRACK_URL}?ids={track_id}&market=from_token') ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\config.py", line 648, in invoke_url headers = cls.get_auth_header() File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\config.py", line 639, in get_auth_header 'Authorization': f'Bearer {cls.__get_auth_token()}', ~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\config.py", line 634, in __get_auth_token ).access_token ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'access_token'

<!-- gh-comment-id:3240075304 --> @RGPZ commented on GitHub (Aug 31, 2025): > [@ulyxie](https://github.com/ulyxie) See if updating to v0.9.25, which uses a new (much cleaner) patch of the upstream library, fixes this. If so, I will push the improvement upstream. What if I still receive this exact issue even on the latest version? `Traceback (most recent call last): File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 207, in download_track track_metadata = get_track_metadata(track_id) File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\track.py", line 53, in get_track_metadata (raw, info) = Zotify.invoke_url(f'{TRACK_URL}?ids={track_id}&market=from_token') ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\config.py", line 648, in invoke_url headers = cls.get_auth_header() File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\config.py", line 639, in get_auth_header 'Authorization': f'Bearer {cls.__get_auth_token()}', ~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\Liamm\pipx\venvs\zotify\Lib\site-packages\zotify\config.py", line 634, in __get_auth_token ).access_token ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'access_token'`
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/zotify#46
No description provided.