[GH-ISSUE #799] Intermittent KeyError: "Unable to find 'header' using path [...] #502

Closed
opened 2026-02-27 23:01:09 +03:00 by kerem · 7 comments
Owner

Originally created by @Silverarmor on GitHub (Aug 16, 2025).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/799

  • I confirm that I have read the FAQ

Hiya - I'm one of the spotDL devs. We've been facing a very intermittent issue where ytmusicapi returns a KeyError every now and then. I assume it may be to do with YT's API but you guys are the experts.

The issue occurs when running YTMusic.search("a"). Every now and then it will return a keyerror, caught here:
github.com/sigma67/ytmusicapi@f6295e50be/ytmusicapi/navigation.py (L123-L127)

ytmusicapi version

1.11.0

To Reproduce

self = YTMusic(language="de")
self.client.search("a")
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\navigation.py:117 in nav    │
│                                                                                                  │
│   116 │   │   for k in items:                                                                    │
│ ❱ 117 │   │   │   root = root[k]                                                                 │
│   118 │   except (KeyError, IndexError, TypeError) as e:                                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'header'

During handling of the above exception, another exception occurred:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in _run_module_as_main:198                                                                       │
│ in _run_code:88                                                                                  │
│                                                                                                  │
│ in <module>:10                                                                                   │
│                                                                                                  │
│ C:\Programming\spotify-downloader\spotdl\console\entry_point.py:53 in console_entry_point        │
│                                                                                                  │
│    52 │   else:                                                                                  │
│ ❱  53 │   │   entry_point()                                                                      │
│    54                                                                                            │
│                                                                                                  │
│ C:\Programming\spotify-downloader\spotdl\console\entry_point.py:100 in entry_point               │
│                                                                                                  │
│    99 │   if "youtube-music" in downloader_settings["audio_providers"]:                          │
│ ❱ 100 │   │   if not check_ytmusic_connection():                                                 │
│   101 │   │   │   raise DownloaderError(                                                         │
│                                                                                                  │
│ C:\Programming\spotify-downloader\spotdl\utils\downloader.py:21 in check_ytmusic_connection      │
│                                                                                                  │
│   20 │   ytm = YouTubeMusic()                                                                    │
│ ❱ 21 │   test_results = ytm.get_results("a")                                                     │
│   22 │   if len(test_results) == 0:                                                              │
│                                                                                                  │
│ C:\Programming\spotify-downloader\spotdl\providers\audio\ytmusic.py:57 in get_results            │
│                                                                                                  │
│   56 │   │                                                                                       │
│ ❱ 57 │   │   search_results = self.client.search(search_term, **kwargs)                          │
│   58                                                                                             │
│                                                                                                  │
│ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\mixins\search.py:213 in     │
│ search                                                                                           │
│                                                                                                  │
│   212 │   │   │   if "musicCardShelfRenderer" in res:                                            │
│ ❱ 213 │   │   │   │   top_result = parse_top_result(                                             │
│   214 │   │   │   │   │   res["musicCardShelfRenderer"], self.parser.get_search_result_types()   │
│                                                                                                  │
│ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\parsers\search.py:36 in     │
│ parse_top_result                                                                                 │
│                                                                                                  │
│    35 │   result_type = get_search_result_type(nav(data, SUBTITLE), search_result_types)         │
│ ❱  36 │   search_result = {"category": nav(data, CARD_SHELF_TITLE), "resultType": result_type}   │
│    37 │   if result_type == "artist":                                                            │
│                                                                                                  │
│ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\navigation.py:121 in nav    │
│                                                                                                  │
│   120 │   │   │   return None                                                                    │
│ ❱ 121 │   │   raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception   │
│   122 │   return root                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: "Unable to find 'header' using path ['header', 'musicCardShelfHeaderBasicRenderer', 'title', 'runs', 0, 'text'] on {'trackingParams': 'CP0CELrABxgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'thumbnail':
{'musicThumbnailRenderer': {'thumbnail': {'thumbnails': [{'url': 'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w60-h60-l90-rj', 'width': 60,
'height': 60}, {'url': 'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w120-h120-l90-rj', 'width': 120, 'height': 120}, {'url':
'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w226-h226-l90-rj', 'width': 226, 'height': 226}, {'url':
'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w544-h544-l90-rj', 'width': 544, 'height': 544}]}, 'thumbnailCrop':
'MUSIC_THUMBNAIL_CROP_UNSPECIFIED', 'thumbnailScale': 'MUSIC_THUMBNAIL_SCALE_ASPECT_FIT', 'trackingParams': 'CIwDEIS_AiITCI3Pgv_dho8DFQ2hSwUdzqUPfA=='}}, 'title': {'runs': [{'text': 'Presenting KAROL G',      
'navigationEndpoint': {'clickTrackingParams': 'CP0CELrABxgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'browseEndpoint': {'browseId': 'VLRDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc',
'browseEndpointContextSupportedConfigs': {'browseEndpointContextMusicConfig': {'pageType': 'MUSIC_PAGE_TYPE_PLAYLIST'}}}}}]}, 'subtitle': {'runs': [{'text': 'Playlist'}, {'text': ' • '}, {'text': 'YouTube     
Music'}]}, 'buttons': [{'buttonRenderer': {'style': 'STYLE_DARK_ON_WHITE', 'size': 'SIZE_DEFAULT', 'text': {'runs': [{'text': 'Zufallsmix'}]}, 'icon': {'iconType': 'MUSIC_SHUFFLE'}, 'accessibility': {'label': 
'Zufallsmix'}, 'trackingParams': 'CIsDEJbSBRgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'accessibilityData': {'accessibilityData': {'label': 'Zufallsmix'}}, 'command': {'clickTrackingParams':
'CIsDEJbSBRgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB8gECGAE%3D'}}}}, {'buttonRenderer': {'style':
'STYLE_WHITE_TRANSLUCENT', 'size': 'SIZE_DEFAULT', 'isDisabled': False, 'text': {'runs': [{'text': 'Wiedergeben'}]}, 'icon': {'iconType': 'PLAY_ARROW'}, 'accessibility': {'label': 'Wiedergeben'},
'trackingParams': 'CIoDEJTSBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'accessibilityData': {'accessibilityData': {'label': 'Wiedergeben'}}, 'command': {'clickTrackingParams':
'CIoDEJTSBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB8gECGAM%3D'}}}}], 'menu': {'menuRenderer': {'items':
[{'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Zufallsmix abspielen'}]}, 'icon': {'iconType': 'MUSIC_SHUFFLE'}, 'navigationEndpoint': {'clickTrackingParams':
'CP8CEKc7IhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB8gECGAE%3D'}}, 'trackingParams':
'CP8CEKc7IhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Radio starten'}]}, 'icon': {'iconType': 'MIX'}, 'navigationEndpoint': {'clickTrackingParams':
'CIkDEJvzBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDAMPLRDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB'}}, 'trackingParams':
'CIkDEJvzBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuServiceItemRenderer': {'text': {'runs': [{'text': 'Als Nächstes abspielen'}]}, 'icon': {'iconType': 'QUEUE_PLAY_NEXT'}, 'serviceEndpoint':
{'clickTrackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'queueAddEndpoint': {'queueTarget': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'onEmptyQueue': {'clickTrackingParams':    
'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc'}}}, 'queueInsertPosition': 'INSERT_AFTER_CURRENT_VIDEO', 'commands':
[{'clickTrackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'addToToastAction': {'item': {'notificationTextRenderer': {'successResponseText': {'runs': [{'text': 'Playlist wird als Nächstes
wiedergegeben'}]}, 'trackingParams': 'CIgDEMrHAyITCI3Pgv_dho8DFQ2hSwUdzqUPfA=='}}}}]}}, 'trackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuServiceItemRenderer': {'text': {'runs': [{'text':  
'In die Wiedergabeliste'}]}, 'icon': {'iconType': 'ADD_TO_REMOTE_QUEUE'}, 'serviceEndpoint': {'clickTrackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'queueAddEndpoint': {'queueTarget':
{'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'onEmptyQueue': {'clickTrackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchEndpoint': {'playlistId':
'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc'}}}, 'queueInsertPosition': 'INSERT_AT_END', 'commands': [{'clickTrackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'addToToastAction': {'item':
{'notificationTextRenderer': {'successResponseText': {'runs': [{'text': 'Playlist wurde der Wiedergabeliste hinzugefügt'}]}, 'trackingParams': 'CIYDEMrHAyITCI3Pgv_dho8DFQ2hSwUdzqUPfA=='}}}}]}},
'trackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'toggleMenuServiceItemRenderer': {'defaultText': {'runs': [{'text': 'Playlist in Mediathek speichern'}]}, 'defaultIcon': {'iconType':
'LIBRARY_ADD'}, 'defaultServiceEndpoint': {'clickTrackingParams': 'CIMDEIT_BRgEIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'modalEndpoint': {'modal': {'modalWithTitleAndButtonRenderer': {'title': {'runs': [{'text': 'Für   
später speichern?'}]}, 'content': {'runs': [{'text': 'Nach der Anmeldung kannst du in deiner Mediathek Favoriten speichern'}]}, 'button': {'buttonRenderer': {'style': 'STYLE_BLUE_TEXT', 'isDisabled': False,   
'text': {'runs': [{'text': 'Anmelden'}]}, 'navigationEndpoint': {'clickTrackingParams': 'CIQDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'signInEndpoint': {'hack': True}}, 'trackingParams':
'CIQDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}}}}}, 'toggledText': {'runs': [{'text': 'Playlist aus Mediathek entfernen'}]}, 'toggledIcon': {'iconType': 'LIBRARY_SAVED'}, 'toggledServiceEndpoint':
{'clickTrackingParams': 'CIMDEIT_BRgEIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'likeEndpoint': {'status': 'INDIFFERENT', 'target': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc'}}}, 'trackingParams':       
'CIMDEIT_BRgEIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Zu Playlist hinzufügen'}]}, 'icon': {'iconType': 'ADD_TO_PLAYLIST'}, 'navigationEndpoint':
{'clickTrackingParams': 'CIEDEMOUBhgFIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'modalEndpoint': {'modal': {'modalWithTitleAndButtonRenderer': {'title': {'runs': [{'text': 'Für später speichern?'}]}, 'content': {'runs':  
[{'text': 'Nach der Anmeldung kannst du Playlists erstellen und teilen'}]}, 'button': {'buttonRenderer': {'style': 'STYLE_BLUE_TEXT', 'isDisabled': False, 'text': {'runs': [{'text': 'Anmelden'}]},
'navigationEndpoint': {'clickTrackingParams': 'CIIDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'signInEndpoint': {'hack': True}}, 'trackingParams': 'CIIDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}}}}}, 'trackingParams':       
'CIEDEMOUBhgFIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Teilen'}]}, 'icon': {'iconType': 'SHARE'}, 'navigationEndpoint': {'clickTrackingParams':
'CIADEJH7BRgGIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'shareEntityEndpoint': {'serializedShareEntity': 'EitSRENMQUs1dXlfbGI3VkRLX0xtUzI3UmQ4NlRxVnk3dk5NNmlqY09JRWtj', 'sharePanelType':
'SHARE_PANEL_TYPE_UNIFIED_SHARE_PANEL'}}, 'trackingParams': 'CIADEJH7BRgGIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}], 'trackingParams': 'CP8CEKc7IhMIjc-C_92GjwMVDaFLBR3OpQ98', 'accessibility': {'accessibilityData':      
{'label': 'Aktionsmenü'}}}}, 'onTap': {'clickTrackingParams': 'CP0CELrABxgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'browseEndpoint': {'browseId': 'VLRDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc',
'browseEndpointContextSupportedConfigs': {'browseEndpointContextMusicConfig': {'pageType': 'MUSIC_PAGE_TYPE_PLAYLIST'}}}}, 'endIcon': {'iconType': 'CHEVRON_RIGHT'}, 'thumbnailOverlay':
{'musicItemThumbnailOverlayRenderer': {'background': {'verticalGradient': {'gradientLayerColors': ['3422552064', '3422552064']}}, 'content': {'musicPlayButtonRenderer': {'playNavigationEndpoint':
{'clickTrackingParams': 'CP4CEMjeAiITCI3Pgv_dho8DFQ2hSwUdzqUPfA==', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB'}}, 'trackingParams':
'CP4CEMjeAiITCI3Pgv_dho8DFQ2hSwUdzqUPfA==', 'playIcon': {'iconType': 'PLAY_ARROW'}, 'pauseIcon': {'iconType': 'PAUSE'}, 'iconColor': 4294967295, 'backgroundColor': 0, 'activeBackgroundColor': 0,
'loadingIndicatorColor': 14745645, 'playingIcon': {'iconType': 'VOLUME_UP'}, 'iconLoadingColor': 0, 'activeScaleFactor': 1, 'buttonSize': 'MUSIC_PLAY_BUTTON_SIZE_LARGE', 'rippleTarget':
'MUSIC_PLAY_BUTTON_RIPPLE_TARGET_SELF', 'accessibilityPlayData': {'accessibilityData': {'label': 'Presenting KAROL G abspielen'}}, 'accessibilityPauseData': {'accessibilityData': {'label': 'Presenting KAROL G 
pausieren'}}}}, 'contentPosition': 'MUSIC_ITEM_THUMBNAIL_OVERLAY_CONTENT_POSITION_CENTERED', 'displayStyle': 'MUSIC_ITEM_THUMBNAIL_OVERLAY_DISPLAY_STYLE_PERSISTENT'}}}, exception: 'header'"

Additional context

It's super intermittent. At first, users reported it but I couldn't reproduce. Then one day suddenly it started happening to me lol. issue tracked at https://github.com/spotDL/spotify-downloader/issues/2438 for us.

Originally created by @Silverarmor on GitHub (Aug 16, 2025). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/799 - [x] I confirm that I have read the [FAQ](https://ytmusicapi.readthedocs.io/en/stable/faq.html#why-is-ytmusicapi-returning-more-results-than-requested-with-the-limit-parameter) Hiya - I'm one of the [spotDL devs](https://github.com/spotDL/spotify-downloader/). We've been facing a very intermittent issue where ytmusicapi returns a KeyError every now and then. I assume it may be to do with YT's API but you guys are the experts. The issue occurs when running `YTMusic.search("a")`. Every now and then it will return a keyerror, caught here: https://github.com/sigma67/ytmusicapi/blob/f6295e50becde8719adc8de722b0b38ee232ec4b/ytmusicapi/navigation.py#L123-L127 **ytmusicapi version** 1.11.0 **To Reproduce** ```py self = YTMusic(language="de") self.client.search("a") ``` ```console ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\navigation.py:117 in nav │ │ │ │ 116 │ │ for k in items: │ │ ❱ 117 │ │ │ root = root[k] │ │ 118 │ except (KeyError, IndexError, TypeError) as e: │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ KeyError: 'header' During handling of the above exception, another exception occurred: ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in _run_module_as_main:198 │ │ in _run_code:88 │ │ │ │ in <module>:10 │ │ │ │ C:\Programming\spotify-downloader\spotdl\console\entry_point.py:53 in console_entry_point │ │ │ │ 52 │ else: │ │ ❱ 53 │ │ entry_point() │ │ 54 │ │ │ │ C:\Programming\spotify-downloader\spotdl\console\entry_point.py:100 in entry_point │ │ │ │ 99 │ if "youtube-music" in downloader_settings["audio_providers"]: │ │ ❱ 100 │ │ if not check_ytmusic_connection(): │ │ 101 │ │ │ raise DownloaderError( │ │ │ │ C:\Programming\spotify-downloader\spotdl\utils\downloader.py:21 in check_ytmusic_connection │ │ │ │ 20 │ ytm = YouTubeMusic() │ │ ❱ 21 │ test_results = ytm.get_results("a") │ │ 22 │ if len(test_results) == 0: │ │ │ │ C:\Programming\spotify-downloader\spotdl\providers\audio\ytmusic.py:57 in get_results │ │ │ │ 56 │ │ │ │ ❱ 57 │ │ search_results = self.client.search(search_term, **kwargs) │ │ 58 │ │ │ │ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\mixins\search.py:213 in │ │ search │ │ │ │ 212 │ │ │ if "musicCardShelfRenderer" in res: │ │ ❱ 213 │ │ │ │ top_result = parse_top_result( │ │ 214 │ │ │ │ │ res["musicCardShelfRenderer"], self.parser.get_search_result_types() │ │ │ │ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\parsers\search.py:36 in │ │ parse_top_result │ │ │ │ 35 │ result_type = get_search_result_type(nav(data, SUBTITLE), search_result_types) │ │ ❱ 36 │ search_result = {"category": nav(data, CARD_SHELF_TITLE), "resultType": result_type} │ │ 37 │ if result_type == "artist": │ │ │ │ C:\Programming\spotify-downloader\.venv\Lib\site-packages\ytmusicapi\navigation.py:121 in nav │ │ │ │ 120 │ │ │ return None │ │ ❱ 121 │ │ raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception │ │ 122 │ return root │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ KeyError: "Unable to find 'header' using path ['header', 'musicCardShelfHeaderBasicRenderer', 'title', 'runs', 0, 'text'] on {'trackingParams': 'CP0CELrABxgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'thumbnail': {'musicThumbnailRenderer': {'thumbnail': {'thumbnails': [{'url': 'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w60-h60-l90-rj', 'width': 60, 'height': 60}, {'url': 'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w120-h120-l90-rj', 'width': 120, 'height': 120}, {'url': 'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w226-h226-l90-rj', 'width': 226, 'height': 226}, {'url': 'https://lh3.googleusercontent.com/P-C4fP1hNWjzNeVKY6eOk7DmJypg5A4FVNeDSPs66K_Lu1mMpnOWRV_O1EjHxaEOzXia97NFXw1A1zg=w544-h544-l90-rj', 'width': 544, 'height': 544}]}, 'thumbnailCrop': 'MUSIC_THUMBNAIL_CROP_UNSPECIFIED', 'thumbnailScale': 'MUSIC_THUMBNAIL_SCALE_ASPECT_FIT', 'trackingParams': 'CIwDEIS_AiITCI3Pgv_dho8DFQ2hSwUdzqUPfA=='}}, 'title': {'runs': [{'text': 'Presenting KAROL G', 'navigationEndpoint': {'clickTrackingParams': 'CP0CELrABxgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'browseEndpoint': {'browseId': 'VLRDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'browseEndpointContextSupportedConfigs': {'browseEndpointContextMusicConfig': {'pageType': 'MUSIC_PAGE_TYPE_PLAYLIST'}}}}}]}, 'subtitle': {'runs': [{'text': 'Playlist'}, {'text': ' • '}, {'text': 'YouTube Music'}]}, 'buttons': [{'buttonRenderer': {'style': 'STYLE_DARK_ON_WHITE', 'size': 'SIZE_DEFAULT', 'text': {'runs': [{'text': 'Zufallsmix'}]}, 'icon': {'iconType': 'MUSIC_SHUFFLE'}, 'accessibility': {'label': 'Zufallsmix'}, 'trackingParams': 'CIsDEJbSBRgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'accessibilityData': {'accessibilityData': {'label': 'Zufallsmix'}}, 'command': {'clickTrackingParams': 'CIsDEJbSBRgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB8gECGAE%3D'}}}}, {'buttonRenderer': {'style': 'STYLE_WHITE_TRANSLUCENT', 'size': 'SIZE_DEFAULT', 'isDisabled': False, 'text': {'runs': [{'text': 'Wiedergeben'}]}, 'icon': {'iconType': 'PLAY_ARROW'}, 'accessibility': {'label': 'Wiedergeben'}, 'trackingParams': 'CIoDEJTSBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'accessibilityData': {'accessibilityData': {'label': 'Wiedergeben'}}, 'command': {'clickTrackingParams': 'CIoDEJTSBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB8gECGAM%3D'}}}}], 'menu': {'menuRenderer': {'items': [{'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Zufallsmix abspielen'}]}, 'icon': {'iconType': 'MUSIC_SHUFFLE'}, 'navigationEndpoint': {'clickTrackingParams': 'CP8CEKc7IhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB8gECGAE%3D'}}, 'trackingParams': 'CP8CEKc7IhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Radio starten'}]}, 'icon': {'iconType': 'MIX'}, 'navigationEndpoint': {'clickTrackingParams': 'CIkDEJvzBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchPlaylistEndpoint': {'playlistId': 'RDAMPLRDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB'}}, 'trackingParams': 'CIkDEJvzBRgBIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuServiceItemRenderer': {'text': {'runs': [{'text': 'Als Nächstes abspielen'}]}, 'icon': {'iconType': 'QUEUE_PLAY_NEXT'}, 'serviceEndpoint': {'clickTrackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'queueAddEndpoint': {'queueTarget': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'onEmptyQueue': {'clickTrackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc'}}}, 'queueInsertPosition': 'INSERT_AFTER_CURRENT_VIDEO', 'commands': [{'clickTrackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'addToToastAction': {'item': {'notificationTextRenderer': {'successResponseText': {'runs': [{'text': 'Playlist wird als Nächstes wiedergegeben'}]}, 'trackingParams': 'CIgDEMrHAyITCI3Pgv_dho8DFQ2hSwUdzqUPfA=='}}}}]}}, 'trackingParams': 'CIcDEL7uBRgCIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuServiceItemRenderer': {'text': {'runs': [{'text': 'In die Wiedergabeliste'}]}, 'icon': {'iconType': 'ADD_TO_REMOTE_QUEUE'}, 'serviceEndpoint': {'clickTrackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'queueAddEndpoint': {'queueTarget': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'onEmptyQueue': {'clickTrackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'watchEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc'}}}, 'queueInsertPosition': 'INSERT_AT_END', 'commands': [{'clickTrackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'addToToastAction': {'item': {'notificationTextRenderer': {'successResponseText': {'runs': [{'text': 'Playlist wurde der Wiedergabeliste hinzugefügt'}]}, 'trackingParams': 'CIYDEMrHAyITCI3Pgv_dho8DFQ2hSwUdzqUPfA=='}}}}]}}, 'trackingParams': 'CIUDEPvvBRgDIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'toggleMenuServiceItemRenderer': {'defaultText': {'runs': [{'text': 'Playlist in Mediathek speichern'}]}, 'defaultIcon': {'iconType': 'LIBRARY_ADD'}, 'defaultServiceEndpoint': {'clickTrackingParams': 'CIMDEIT_BRgEIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'modalEndpoint': {'modal': {'modalWithTitleAndButtonRenderer': {'title': {'runs': [{'text': 'Für später speichern?'}]}, 'content': {'runs': [{'text': 'Nach der Anmeldung kannst du in deiner Mediathek Favoriten speichern'}]}, 'button': {'buttonRenderer': {'style': 'STYLE_BLUE_TEXT', 'isDisabled': False, 'text': {'runs': [{'text': 'Anmelden'}]}, 'navigationEndpoint': {'clickTrackingParams': 'CIQDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'signInEndpoint': {'hack': True}}, 'trackingParams': 'CIQDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}}}}}, 'toggledText': {'runs': [{'text': 'Playlist aus Mediathek entfernen'}]}, 'toggledIcon': {'iconType': 'LIBRARY_SAVED'}, 'toggledServiceEndpoint': {'clickTrackingParams': 'CIMDEIT_BRgEIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'likeEndpoint': {'status': 'INDIFFERENT', 'target': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc'}}}, 'trackingParams': 'CIMDEIT_BRgEIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Zu Playlist hinzufügen'}]}, 'icon': {'iconType': 'ADD_TO_PLAYLIST'}, 'navigationEndpoint': {'clickTrackingParams': 'CIEDEMOUBhgFIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'modalEndpoint': {'modal': {'modalWithTitleAndButtonRenderer': {'title': {'runs': [{'text': 'Für später speichern?'}]}, 'content': {'runs': [{'text': 'Nach der Anmeldung kannst du Playlists erstellen und teilen'}]}, 'button': {'buttonRenderer': {'style': 'STYLE_BLUE_TEXT', 'isDisabled': False, 'text': {'runs': [{'text': 'Anmelden'}]}, 'navigationEndpoint': {'clickTrackingParams': 'CIIDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'signInEndpoint': {'hack': True}}, 'trackingParams': 'CIIDEPBbIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}}}}}, 'trackingParams': 'CIEDEMOUBhgFIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}, {'menuNavigationItemRenderer': {'text': {'runs': [{'text': 'Teilen'}]}, 'icon': {'iconType': 'SHARE'}, 'navigationEndpoint': {'clickTrackingParams': 'CIADEJH7BRgGIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'shareEntityEndpoint': {'serializedShareEntity': 'EitSRENMQUs1dXlfbGI3VkRLX0xtUzI3UmQ4NlRxVnk3dk5NNmlqY09JRWtj', 'sharePanelType': 'SHARE_PANEL_TYPE_UNIFIED_SHARE_PANEL'}}, 'trackingParams': 'CIADEJH7BRgGIhMIjc-C_92GjwMVDaFLBR3OpQ98'}}], 'trackingParams': 'CP8CEKc7IhMIjc-C_92GjwMVDaFLBR3OpQ98', 'accessibility': {'accessibilityData': {'label': 'Aktionsmenü'}}}}, 'onTap': {'clickTrackingParams': 'CP0CELrABxgAIhMIjc-C_92GjwMVDaFLBR3OpQ98', 'browseEndpoint': {'browseId': 'VLRDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'browseEndpointContextSupportedConfigs': {'browseEndpointContextMusicConfig': {'pageType': 'MUSIC_PAGE_TYPE_PLAYLIST'}}}}, 'endIcon': {'iconType': 'CHEVRON_RIGHT'}, 'thumbnailOverlay': {'musicItemThumbnailOverlayRenderer': {'background': {'verticalGradient': {'gradientLayerColors': ['3422552064', '3422552064']}}, 'content': {'musicPlayButtonRenderer': {'playNavigationEndpoint': {'clickTrackingParams': 'CP4CEMjeAiITCI3Pgv_dho8DFQ2hSwUdzqUPfA==', 'watchPlaylistEndpoint': {'playlistId': 'RDCLAK5uy_lb7VDK_LmS27Rd86TqVy7vNM6ijcOIEkc', 'params': 'wAEB'}}, 'trackingParams': 'CP4CEMjeAiITCI3Pgv_dho8DFQ2hSwUdzqUPfA==', 'playIcon': {'iconType': 'PLAY_ARROW'}, 'pauseIcon': {'iconType': 'PAUSE'}, 'iconColor': 4294967295, 'backgroundColor': 0, 'activeBackgroundColor': 0, 'loadingIndicatorColor': 14745645, 'playingIcon': {'iconType': 'VOLUME_UP'}, 'iconLoadingColor': 0, 'activeScaleFactor': 1, 'buttonSize': 'MUSIC_PLAY_BUTTON_SIZE_LARGE', 'rippleTarget': 'MUSIC_PLAY_BUTTON_RIPPLE_TARGET_SELF', 'accessibilityPlayData': {'accessibilityData': {'label': 'Presenting KAROL G abspielen'}}, 'accessibilityPauseData': {'accessibilityData': {'label': 'Presenting KAROL G pausieren'}}}}, 'contentPosition': 'MUSIC_ITEM_THUMBNAIL_OVERLAY_CONTENT_POSITION_CENTERED', 'displayStyle': 'MUSIC_ITEM_THUMBNAIL_OVERLAY_DISPLAY_STYLE_PERSISTENT'}}}, exception: 'header'" ``` **Additional context** It's super intermittent. At first, users reported it but I couldn't reproduce. Then one day suddenly it started happening to me lol. issue tracked at https://github.com/spotDL/spotify-downloader/issues/2438 for us.
kerem 2026-02-27 23:01:09 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@sigma67 commented on GitHub (Aug 16, 2025):

So basically it expects the header key to exist. Which usually it does - it's the part that states "Top result" at the top of the results page.

In your data, the header key is completely missing. I do wonder what the page would look like in that case - but I guess the JS on the page is able to handle it, so we should as well.

<!-- gh-comment-id:3193490168 --> @sigma67 commented on GitHub (Aug 16, 2025): So basically it expects the `header` key to exist. Which usually it does - it's the part that states "Top result" at the top of the results page. In your data, the `header` key is completely missing. I do wonder what the page would look like in that case - but I guess the JS on the page is able to handle it, so we should as well.
Author
Owner

@sigma67 commented on GitHub (Aug 16, 2025):

I have pushed a fix to the linked PR. Please test it since I cannot reproduce the issue. I hope it doesn't fail at a later point due to the header expected to be present..

<!-- gh-comment-id:3193495939 --> @sigma67 commented on GitHub (Aug 16, 2025): I have pushed a fix to the linked PR. Please test it since I cannot reproduce the issue. I hope it doesn't fail at a later point due to the header expected to be present..
Author
Owner

@astonm commented on GitHub (Aug 16, 2025):

I ran into the same KeyError and can verify the patch in 93523b5 works for me. Thanks!

<!-- gh-comment-id:3193719403 --> @astonm commented on GitHub (Aug 16, 2025): I ran into the same `KeyError` and can verify the patch in 93523b5 works for me. Thanks!
Author
Owner

@Silverarmor commented on GitHub (Aug 17, 2025):

Thanks. I'll test on the PR. The issue was very intermittent and only randomly showed up (I struggled to reproduce it for a few days).

<!-- gh-comment-id:3194109567 --> @Silverarmor commented on GitHub (Aug 17, 2025): Thanks. I'll test on the PR. The issue was very intermittent and only randomly showed up (I struggled to reproduce it for a few days).
Author
Owner

@Silverarmor commented on GitHub (Aug 30, 2025):

Hi @sigma67, when can we expect next version to be released?

<!-- gh-comment-id:3238826527 --> @Silverarmor commented on GitHub (Aug 30, 2025): Hi @sigma67, when can we expect next version to be released?
Author
Owner

@sigma67 commented on GitHub (Aug 30, 2025):

@Silverarmor 1.11.1 created

<!-- gh-comment-id:3239502795 --> @sigma67 commented on GitHub (Aug 30, 2025): @Silverarmor 1.11.1 created
Author
Owner

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

Thanks!

<!-- gh-comment-id:3239634968 --> @Silverarmor commented on GitHub (Aug 31, 2025): Thanks!
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/ytmusicapi#502
No description provided.