Skip to content

[Bug]: get_album fails to decode object-shaped preReleaseEndDateTime #105

Closed

Description

@Balake

What happened?

get_album raises BaseClientError for albums whose getAlbum response includes preReleaseEndDateTime. Spotify now returns that field as an object, {"isoString": "...", "precision": "DAY" | "MINUTE"}, even when isPreRelease is false. AlbumDetails.pre_release_end_date_time is declared str | None, so decoding fails.

Minimal reproduction

from spotapi import SyncCatalogue

with SyncCatalogue() as catalogue:
   album = catalogue.get_album("spotify:album:3LUcDBe7DZDExhHbZEQchk")  # "Aba Khan" by Nytt Land, public
   print(album.name)

Expected behavior

get_album returns AlbumDetails with pre_release_end_date_time decoded as a date (like AlbumDetails.date's ReleaseDate), and search keeps those albums.

Actual behavior

spotapi.types.exceptions.BaseClientError: getAlbum: failed to deserialize AlbumDetails: AlbumDetails.pre_release_end_date_time: value does not match str | None

SpotAPI version

2.1.1 (also present on main at b7134ed)

Python version

3.12.15

Area

Models, typing, or serialization

Operating system

macOS

Relevant logs

Checklist

  • I searched existing issues and discussions for this problem.
  • I reproduced this on the latest SpotAPI release, or explained why I could not.
  • I removed all credentials and private account data.

Activity

  1. Aran404 commented on Nov 22, 2026

    @Aran404
    Owner

    Thanks for the precise reproduction and error report! The mismatch is confirmed in both album models, and I also found a published Spotify-derived payload with an object-shaped preReleaseEndDateTime (including a case where precision is omitted).

    I've opened #106 with a typed, backward-compatible fix and offline regressions covering the getAlbum decoder and album-search retention. CI is running now. I haven't independently retrieved the exact live response for spotify:album:3LUcDBe7DZDExhHbZEQchk yet, so I'll leave this issue open until the fix is verified against Spotify as well.

  2. Aran404 commented on Nov 22, 2026

    @Aran404
    Owner

    Thanks for reporting this, especially with a reproducible album URI! You were right — Spotify is returning preReleaseEndDateTime as an object now, but both of our album models were expecting a string.

    I've fixed it in #106 and merged it into main. All the CI checks passed, and I added a regression test for the exact album you linked so we can catch this if it breaks again.

    I haven't verified that specific album against live Spotify yet, so I'll leave the issue open until we confirm it. Really appreciate you taking the time to track this down!

  3. Balake commented on Nov 22, 2026

    @Balake
    Author

    @Aran404 thanks!

  4. Aran404 commented on Nov 22, 2026

    @Aran404
    Owner

    @Aran404 thanks!

    No problem, let me know if that works now so I can publish 2.1.3 to pypi.

  5. Balake commented on Nov 22, 2026

    @Balake
    Author

    @Aran404 This works for me! I had 10 albums that were failing and they all work on main now.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions