music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

Spotify: skip empty entries when syncing library albums (#6114)

_This issue was auto triaged._

# What does this implement/fix?

Syncing the Spotify album library aborts with `TypeError: 'NoneType'
object is not subscriptable`. Spotify's paged endpoints can return a
`null` entry in the `items` array for content the account can no longer
resolve, and `_get_all_items` passed that `null` straight through to its
callers even though it is annotated to yield dicts. `get_library_albums`
then subscripted it and the whole sync task died, so the album library
never finished syncing.

`get_library_tracks`, `get_library_audiobooks` and
`get_library_playlists` each carried their own `if item and ...` guard
against this; `get_library_albums`, `get_library_podcasts` and
`get_album_tracks` did not. Dropping the empty entries in
`_get_all_items` fixes it once for every caller.

**Related issue (if applicable):**

- related issue https://github.com/music-assistant/support/issues/6255

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue) — `bugfix`
- [ ] New feature (non-breaking change which adds functionality) —
`new-feature`
- [ ] Enhancement to an existing feature — `enhancement`
- [ ] New music/player/metadata/plugin provider — `new-provider`
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected) — `breaking-change`
- [ ] Refactor (no behaviour change) — `refactor`
- [ ] Documentation only — `documentation`
- [ ] Maintenance / chore — `maintenance`
- [ ] CI / workflow change — `ci`
- [ ] Dependencies bump — `dependencies`

## Checklist

- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
- [ ] For changes to shared models, the companion PR in
`music-assistant/models` is linked.
- [ ] For changes affecting the UI, the companion PR in
`music-assistant/frontend` is linked.
- [x] I have read and complied with the project's [AI
Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md)
for any AI-assisted contributions.
- [ ] I have [raised a PR against the documentation
repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md)
targeting the main or beta branch as appropriate.
Forgejo

Author

Marvin Schenkel<[email protected]>
August 31, 2026 at 12:52 PM UTC

Committer

Marvin Schenkel<[email protected]>
September 4, 2026 at 07:55 AM UTC
59additions
0deletions
2files changed

Parent commits

Changes

2 files
+59-0

Changed Files (2)

music_assistant/providers/spotify/
tests/providers/spotify/
music_assistant/providers/spotify/provider.py
tests/providers/spotify/test_library_albums.py
+59