[GH-ISSUE #149] [Bug Report] Metadata KeyError (album_type) #131

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

Originally created by @SnackaJax on GitHub (Jan 12, 2026).
Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/149

Originally assigned to: @Googolplexed0 on GitHub.

Zotify Version
v0.11.15

Bug Description
When trying to download a specific playlist, an error appears during the Parsing Playlist Info stage.

Bug Triggering Command
zotify https://open.spotify.com/playlist/3mvGR7mx1MXQb8jyX1CXrI --print-skips TRUE --skip-existing TRUE --config-location G:\Users\SnackaJax\AppData\Roaming\Zotify --creds G:\Users\SnackaJax\AppData\Roaming\Zotify --client-id cef47aea04974db3b294cd6a600f35a9

Error Traceback / Logs
zotify_DEBUG_2026-01-12_13-00-40.log

Console output:

DEBUG

config_DEBUG.json saved to G:\Users\SnackaJax\AppData\Roaming\Zotify

zotify_DEBUG_2026-01-12_13-00-40.log logging to I:\Zotify Downloads

    [∙∙●] Logging in...                                                                                             

DEBUG
Session Initialized Successfully
User Subscription Type: PREMIUM
Request Parsed as 1 URL

    [∙●∙] Fetching playlist information...                                                                                  [∙∙∙] Parsing playlist information...                                                                           

DEBUG
Total API Calls: 7

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "c:\users\snackajax.local\bin\zotify.exe_main
.py", line 6, in
sys.exit(main())
~~~~^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify_main
.py", line 143, in main
client(args, modes)
~~~~~~^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 85, in client
perform_query(args)
~~~~~~~~~~~~~^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 77, in perform_query
raise e
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 48, in perform_query
Query(Zotify.DATETIME_LAUNCH).request(urls).execute()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1725, in execute
self.parse_direct_metadata(*self.fetch_direct_metadata(direct_reqs_objs))
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1540, in parse_direct_metadata
obj.grab_more_children(hide_loader=True)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1161, in grab_more_children
self._main_items.extend(self.parse_linked_objs(item_resps, self._contains))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 267, in parse_linked_objs
obj.parse_metadata(resp) # theoretically shouldn't lose metadata by re-parsing if obj was parsed prev
~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 565, in parse_metadata
self.artists = self.parse_linked_objs(track_resp[ARTISTS], Artist)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 267, in parse_linked_objs
obj.parse_metadata(resp) # theoretically shouldn't lose metadata by re-parsing if obj was parsed prev
~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1282, in parse_metadata
if album_resp[ALBUM_TYPE]: self.type: str = album_resp[ALBUM_TYPE]
~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'album_type'

Config File

config_DEBUG.json

Additional Context
I am on the Efficient-api branch. I have been able to download a big playlist (over 4000 tracks) just fine on this version over the course of a couple of days. It seems like an issue with this playlist. Haven't found other playlist with the same issue yet. I have been able to download this playlist before on earlier versions of the main branch.

Originally created by @SnackaJax on GitHub (Jan 12, 2026). Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/149 Originally assigned to: @Googolplexed0 on GitHub. **Zotify Version** v0.11.15 **Bug Description** When trying to download a specific playlist, an error appears during the Parsing Playlist Info stage. **Bug Triggering Command** zotify https://open.spotify.com/playlist/3mvGR7mx1MXQb8jyX1CXrI --print-skips TRUE --skip-existing TRUE --config-location G:\Users\SnackaJax\AppData\Roaming\Zotify --creds G:\Users\SnackaJax\AppData\Roaming\Zotify --client-id cef47aea04974db3b294cd6a600f35a9 **Error Traceback / Logs** [zotify_DEBUG_2026-01-12_13-00-40.log](https://github.com/user-attachments/files/24563259/zotify_DEBUG_2026-01-12_13-00-40.log) Console output: DEBUG ### config_DEBUG.json saved to G:\Users\SnackaJax\AppData\Roaming\Zotify ### ### zotify_DEBUG_2026-01-12_13-00-40.log logging to I:\Zotify Downloads ### [∙∙●] Logging in... DEBUG Session Initialized Successfully User Subscription Type: PREMIUM Request Parsed as 1 URL [∙●∙] Fetching playlist information... [∙∙∙] Parsing playlist information... DEBUG Total API Calls: 7 Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "c:\users\snackajax\.local\bin\zotify.exe\__main__.py", line 6, in <module> sys.exit(main()) ~~~~^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\__main__.py", line 143, in main client(args, modes) ~~~~~~^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 85, in client perform_query(args) ~~~~~~~~~~~~~^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 77, in perform_query raise e File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 48, in perform_query Query(Zotify.DATETIME_LAUNCH).request(urls).execute() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1725, in execute self.parse_direct_metadata(*self.fetch_direct_metadata(direct_reqs_objs)) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1540, in parse_direct_metadata obj.grab_more_children(hide_loader=True) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1161, in grab_more_children self._main_items.extend(self.parse_linked_objs(item_resps, self._contains)) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 267, in parse_linked_objs obj.parse_metadata(resp) # theoretically shouldn't lose metadata by re-parsing if obj was parsed prev ~~~~~~~~~~~~~~~~~~^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 565, in parse_metadata self.artists = self.parse_linked_objs(track_resp[ARTISTS], Artist) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 267, in parse_linked_objs obj.parse_metadata(resp) # theoretically shouldn't lose metadata by re-parsing if obj was parsed prev ~~~~~~~~~~~~~~~~~~^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1282, in parse_metadata if album_resp[ALBUM_TYPE]: self.type: str = album_resp[ALBUM_TYPE] ~~~~~~~~~~^^^^^^^^^^^^ KeyError: 'album_type' **Config File** [config_DEBUG.json](https://github.com/user-attachments/files/24563277/config_DEBUG.json) **Additional Context** I am on the Efficient-api branch. I have been able to download a big playlist (over 4000 tracks) just fine on this version over the course of a couple of days. It seems like an issue with this playlist. Haven't found other playlist with the same issue yet. I have been able to download this playlist before on earlier versions of the main branch.
kerem 2026-02-27 04:57:43 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Googolplexed0 commented on GitHub (Jan 20, 2026):

@SnackaJax see if the new-hierarchy branch fixes this issue.

<!-- gh-comment-id:3770806168 --> @Googolplexed0 commented on GitHub (Jan 20, 2026): @SnackaJax see if the [new-hierarchy branch](https://github.com/Googolplexed0/zotify/tree/new-hierarchy) fixes this issue.
Author
Owner

@SnackaJax commented on GitHub (Jan 20, 2026):

@Googolplexed0 Thanks for your work, but the issue does not look fixed unfortunately. I have ran the same command as before.

zotify_DEBUG_2026-01-20_09-41-52.log

config_DEBUG.json

Console Output:
DEBUG

config_DEBUG.json saved to G:\Users\jacco\AppData\Roaming\Zotify

zotify_DEBUG_2026-01-20_09-41-52.log logging to I:\Zotify Downloads

    [∙∙●] Logging in...                                                                                                                                                  

DEBUG
Session Initialized Successfully
User Subscription Type: PREMIUM
Request Parsed as 1 URL

    [∙●∙] Fetching playlist information...                                                                                                                                       [∙∙∙] Parsing playlist information...                                                                                                                                

Parsing Parent #0 of Track (::Dimitri+K++MBK++ID:143)

Expected Relative Types: ['Album']

    [●∙∙] Parsing playlist information...                                                                                                                                

#############################################################################################################################################################################
{ 'album_type': None,
'artists': [],
'external_urls': 'URL REMOVED FOR BREVITY',
'href': None,
'id': None,
'images': 'LIST REMOVED FOR BREVITY',
'name': '',
'release_date': None,
'release_date_precision': None,
'type': 'album',
'uri': None}
#############################################################################################################################################################################

    [∙∙∙] Parsing playlist information...                                                                                                                                

DEBUG
Total API Calls: 6

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "c:\users\snackajax.local\bin\zotify.exe_main
.py", line 6, in
sys.exit(main())
~~~~^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify_main
.py", line 143, in main
client(args, modes)
~~~~~~^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 186, in client
perform_query(args)
~~~~~~~~~~~~~^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 178, in perform_query
raise e
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 149, in perform_query
Query(Zotify.DATETIME_LAUNCH).request(urls).execute()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1506, in execute
self.parse_query_metadata(self.fetch_query_metadata())
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1356, in parse_query_metadata
if obj.needs_expansion: obj.grab_more_children(hide_loader=True)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1064, in grab_more_children
item_objs = self.parse_relatives(item_resps, self._contains)
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 267, in parse_relatives
new_relative.parse_metadata(self, resp)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 231, in parse_metadata
for k, v in Metadata(self, resp).dict.items():
~~~~~~~~^^^^^^^^^^^^
File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 151, in init
self.album : Album = obj.parse_relatives([album], Album, make_parent=parent)[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
PS C:\Users\SnackaJax>

After reviewing the error I saw it got stuck on a track that I have manually added to the playlist as an MP3 file from my PC.(Dimitri+K++MBK++ID). After removing this track it got stuck on the next "custom" track in that playlist. Zotify used to ignore these tracks as far as I can see, becuase I don't see the "custom" tracks in the downloaded folder from previous attempts.

Have I just been lucky with it skipping those tracks before, or is zotify supposed to handle these kinds of tracks?

Edit: I also tried selecting the playlist after using the --p argument, and it gave the same error

<!-- gh-comment-id:3771742266 --> @SnackaJax commented on GitHub (Jan 20, 2026): @Googolplexed0 Thanks for your work, but the issue does not look fixed unfortunately. I have ran the same command as before. [zotify_DEBUG_2026-01-20_09-41-52.log](https://github.com/user-attachments/files/24733017/zotify_DEBUG_2026-01-20_09-41-52.log) [config_DEBUG.json](https://github.com/user-attachments/files/24733230/config_DEBUG.json) Console Output: DEBUG ### config_DEBUG.json saved to G:\Users\jacco\AppData\Roaming\Zotify ### ### zotify_DEBUG_2026-01-20_09-41-52.log logging to I:\Zotify Downloads ### [∙∙●] Logging in... DEBUG Session Initialized Successfully User Subscription Type: PREMIUM Request Parsed as 1 URL [∙●∙] Fetching playlist information... [∙∙∙] Parsing playlist information... ### WARNING: Missing Expected Response for Related Metadata Object ### ### Parsing Parent #0 of Track (::Dimitri+K++MBK++ID:143) ### ### Expected Relative Types: ['Album'] ### [●∙∙] Parsing playlist information... ############################################################################################################################################################################# { 'album_type': None, 'artists': [], 'external_urls': 'URL REMOVED FOR BREVITY', 'href': None, 'id': None, 'images': 'LIST REMOVED FOR BREVITY', 'name': '', 'release_date': None, 'release_date_precision': None, 'type': 'album', 'uri': None} ############################################################################################################################################################################# [∙∙∙] Parsing playlist information... DEBUG Total API Calls: 6 Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "c:\users\snackajax\.local\bin\zotify.exe\__main__.py", line 6, in <module> sys.exit(main()) ~~~~^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\__main__.py", line 143, in main client(args, modes) ~~~~~~^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 186, in client perform_query(args) ~~~~~~~~~~~~~^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 178, in perform_query raise e File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\app.py", line 149, in perform_query Query(Zotify.DATETIME_LAUNCH).request(urls).execute() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1506, in execute self.parse_query_metadata(self.fetch_query_metadata()) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1356, in parse_query_metadata if obj.needs_expansion: obj.grab_more_children(hide_loader=True) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 1064, in grab_more_children item_objs = self.parse_relatives(item_resps, self._contains) File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 267, in parse_relatives new_relative.parse_metadata(self, resp) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 231, in parse_metadata for k, v in Metadata(self, resp).__dict__.items(): ~~~~~~~~^^^^^^^^^^^^ File "C:\Users\SnackaJax\pipx\venvs\zotify\Lib\site-packages\zotify\api.py", line 151, in __init__ self.album : Album = obj.parse_relatives([album], Album, make_parent=parent)[0] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range PS C:\Users\SnackaJax> After reviewing the error I saw it got stuck on a track that I have manually added to the playlist as an MP3 file from my PC.(Dimitri+K++MBK++ID). After removing this track it got stuck on the next "custom" track in that playlist. Zotify used to ignore these tracks as far as I can see, becuase I don't see the "custom" tracks in the downloaded folder from previous attempts. Have I just been lucky with it skipping those tracks before, or is zotify supposed to handle these kinds of tracks? Edit: I also tried selecting the playlist after using the --p argument, and it gave the same error
Author
Owner

@Googolplexed0 commented on GitHub (Jan 20, 2026):

Have I just been lucky with it skipping those tracks before, or is zotify supposed to handle these kinds of tracks?

It is supposed to handle custom tracks. This should be easily fixable, the new metadata system just needs a few minor tweaks. There are always a few hidden issues with total reworks like this.

<!-- gh-comment-id:3773924531 --> @Googolplexed0 commented on GitHub (Jan 20, 2026): > Have I just been lucky with it skipping those tracks before, or is zotify supposed to handle these kinds of tracks? It is supposed to handle custom tracks. This should be easily fixable, the new metadata system just needs a few minor tweaks. There are always a few hidden issues with total reworks like this.
Author
Owner

@Googolplexed0 commented on GitHub (Jan 21, 2026):

Should be fixed with github.com/Googolplexed0/zotify@ee88dfca80

<!-- gh-comment-id:3776208761 --> @Googolplexed0 commented on GitHub (Jan 21, 2026): Should be fixed with https://github.com/Googolplexed0/zotify/commit/ee88dfca800042a971ae0df6ebbb7a04aa99ad1b
Author
Owner

@SnackaJax commented on GitHub (Jan 21, 2026):

Thanks again for fixing and maintaining this project @Googolplexed0 :)

<!-- gh-comment-id:3777061232 --> @SnackaJax commented on GitHub (Jan 21, 2026): Thanks again for fixing and maintaining this project @Googolplexed0 :)
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#131
No description provided.