Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#2767·spotify-downloader

Album sync: KeyError: 'label' when Spotify API album response omits the label field

Author: tijlkCreated Aug 14, 2026Updated Aug 19, 2026

Description

Album.get_metadata in spotdl/types/album.py accesses album_metadata["label"] directly (line 100). For some albums, the Spotify Web API response omits the label key entirely rather than returning null, which raises an uncaught KeyError and aborts the whole sync.

Steps to reproduce

spotdl sync https://open.spotify.com/album/30Wo9HOMHXB2zCJ6RmOpsV --use-official-api --client-id <id> --client-secret <secret> --user-auth

Actual result

KeyError: 'label'
  File ".../spotdl/types/album.py", line 100, in get_metadata
    publisher=album_metadata["label"],

I confirmed directly via spotipy that the raw API response for this album has no label key at all:

python
album = sp.album('30Wo9HOMHXB2zCJ6RmOpsV')
'label' in album  # False

Expected result

Falls back gracefully (e.g. empty string) when label is absent, the same way other optional fields are handled elsewhere in this file.

Suggested fix

diff
-                publisher=album_metadata["label"],
+                publisher=album_metadata.get("label", ""),

Verified this one-line change fixes the crash locally.

Environment

  • spotdl 4.5.2 (latest on PyPI)
  • Official Spotify Web API via --user-auth
  • macOS, Python 3.14

Source: spotDL/spotify-downloader

View original on GitHubView discussion on GitHub