Skip to content

get_playlist fails on the new "item" wrapper (Feb 2026 API change) #774

Closed

Description

@maxmaxme

Since Spotify's Feb 2026 Web API migration, playlist responses wrap each entry in item instead of track (tracks.track → items.item), and track is now marked deprecated.

PlaylistTrack still requires track, so get_playlist and get_playlist_items fail on the new payload:

MissingField: Field "track" of type Item is missing in PlaylistTrack instance
→ InvalidFieldValue: Field "items" of type list[PlaylistTrack] in PlaylistTracks ...
→ InvalidFieldValue: Field "items" of type PlaylistTracks in Playlist ...

Reproduced on spotifyaio==2.0.2: feeding a real playlist-items response (entries with item and no track) to Playlist.from_json / PlaylistTracks raises the above; adding track = item makes it parse.

This is currently breaking the Home Assistant Spotify integration (home-assistant/core#165877).

track is still sent during the deprecation window, so both shapes need to work. I think the cleanest fix is normalizing item → track in PlaylistTrack.__pre_deserialize__, mirroring what Playlist.__pre_deserialize__ already does for tracks → items. Happy to open a PR.

Related: #767 handles a missing items list (metadata-only playlists) but not the track/item rename.

Activity

  1. github-actions commented on Jun 30, 2026

    @github-actions

    There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
    Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
    This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

  2. added
    stale
    on Jun 30, 2026
  3. rqbanerjee commented on Jul 2, 2026

    @rqbanerjee

    Still an issue in Home assistant, which is pinned to version 2.0.2 of this library. Hoass will need to update their manifest once this pr is merged and released..

  4. removed
    stale
    on Jul 3, 2026
  5. github-actions commented on Aug 3, 2026

    @github-actions

    There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
    Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
    This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

  6. added
    stale
    on Aug 3, 2026
  7. maxmaxme commented on Aug 3, 2026

    @maxmaxme
    Author

    The issue is still relevant

  8. removed
    stale
    on Aug 4, 2026
  9. epixcz commented on Aug 5, 2026

    @epixcz

    I can confirm this also breaks Home Assistant Spotify browsing on my HA instance.

    Home Assistant Core: 2026.x
    spotifyaio: 2.0.2

    The failing payload contains playlist entries with item and no track, and HA shows:

    Field "items" of type PlaylistTracks in Playlist has invalid value ...

    A local patch that normalizes item -> track in PlaylistTrack.__pre_deserialize__ fixes browsing the affected Spotify Liked Songs / playlist-like collection for me.

  10. github-actions commented on Sep 4, 2026

    @github-actions

    There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
    Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
    This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

  11. added
    stale
    on Sep 4, 2026
  12. maxmaxme commented on Sep 4, 2026

    @maxmaxme
    Author

    The issue is still relevant

  13. removed
    stale
    on Sep 5, 2026
  14. github-actions commented on Oct 5, 2026

    @github-actions

    There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
    Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
    This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

  15. added
    stale
    on Oct 5, 2026
  16. maxmaxme commented on Oct 5, 2026

    @maxmaxme
    Author

    The issue is still relevant

  17. removed
    stale
    on Oct 6, 2026
  18. epixcz commented on Oct 19, 2026

    @epixcz

    Retested with Home Assistant Core 2026.10.2 and spotifyaio 2.0.2, without the previous local patch.
    While playing the affected Liked Songs collection, I fetched the current playlist response directly from Spotify and passed it to spotifyaio.models.Playlist.from_json():

    • Playback context type: playlist
    • Entries returned: 100
    • Entries containing item: 100
    • Entries containing track: 0
    • Deserialization: failed with InvalidFieldValue, with another InvalidFieldValue as the nested exception.
      The library issue therefore still reproduces with the current Spotify response.

    However, the HA integration now continues working during playback because Core catches InvalidFieldValue and MissingField when fetching optional playlist metadata and continues without that metadata. This handling was added in home-assistant/core#183143 and is present in Core 2026.10.2.
    So the playback improvement in HA does not mean the underlying parsing issue is resolved; it prevents the playlist deserialization failure from breaking playback state updates.

  19. locked and limited conversation to collaborators on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions