Repository navigation
Skip playlist entries whose track is unavailable - #854
Merged
joostlek merged 2 commits intoNov 4, 2026
Merged
Conversation
Spotify returns "track": null for playlist entries that are no longer available, which made get_playlist and get_playlist_items fail with InvalidFieldValue for the whole playlist. Drop those entries, like local tracks already are.
Combine the unavailable-track filter with the local-file filter from main. Check the "item" field before "track", the same order PlaylistTrack uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Spotify returns
"track": nullfor playlist entries that are no longer available.PlaylistTrack.trackisn't optional, so one such entry makes the whole playlist fail to parse:That's what home-assistant/core#181111 runs into when browsing a playlist.
This drops those entries before deserializing, the same way
PlaylistTracksalready drops local tracks:PlaylistTracks.__pre_deserialize__(used byget_playlist) now also skips entries without a track.PlaylistTrackResponse(used byget_playlist_items) gets the same filter in a new__pre_deserialize__.The check is
item.get("track", item.get("item")) is not None, so it also works for entries that only carry the neweritemkey (the rename #775 handles).Added
test_get_playlist_skips_unavailable_tracksandtest_get_playlist_items_skips_unavailable_tracks. Each serves an existing fixture with an extra entry whosetrackanditemarenull, and checks that only the real entry comes back. Both fail with the error above without the change. The full suite passes (108 tests, snapshots unchanged).Related Issues