[GH-ISSUE #943] new-api: crash when retrieving album metadata #460

Closed
opened 2026-02-27 19:30:45 +03:00 by kerem · 2 comments
Owner

Originally created by @gdesmott on GitHub (Jan 23, 2022).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/943

Trying to retrieve album metadata using the new-api branch raises this crash.

let album_id = SpotifyId::from_uri("spotify:album:2iUX7KsTPIjAUuQfp8Wf49").unwrap();
let album = librespot::metadata::Album::get(&session, album_id)
        .await
        .unwrap();
dbg!(&album);
[2022-01-23T21:07:06Z TRACE librespot_metadata] Received metadata: gid: "K\275WO\202\332D\021\246\260\271\210\215\202\037\215"
    name: "Ding Dong Song"
    artist {
      gid: "\265\326\230\036\n|H\030\246f6\313_\336D\360"
      name: "G\303\274nther"
    }
    type: SINGLE
    label: "WM Sweden"
    date {
      year: 2004
    }
    popularity: 47
    external_id {
      type: "upc"
      id: "825646421176"
    }
    disc {
      number: 1
      track {
        gid: "l$o\313\377H@?\255\251\206W9\031\325\226"
      }
      track {
        gid: "g\222\235\233;\031A\272\267\002\217\207\020\327\'M"
      }
      track {
        gid: "D\216\304\234.\227B\200\210J\346uo\314\021\315"
      }
    }
    copyright {
      type: C
      text: "\302\251 2004 Warner Music Sweden AB"
    }
    copyright {
      type: P
      text: "\342\204\227 2004 Warner Music Sweden AB"
    }
    cover_group {
      image {
        file_id: "\253gam\000\000\036\002b\2639/\320\357\323k\000\006\226\321"
        size: DEFAULT
        width: 300
        height: 300
      }
      image {
        file_id: "\253gam\000\000HQb\2639/\320\357\323k\000\006\226\321"
        size: SMALL
        width: 64
        height: 64
      }
      image {
        file_id: "\253gam\000\000\262sb\2639/\320\357\323k\000\006\226\321"
        size: LARGE
        width: 640
        height: 640
      }
    }
    original_title: "Ding Dong Song"
    
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: OutOfRange, error: ComponentRange { name: "month", minimum: 1, maximum: 12, value: 0, conditional_range: false } }', audio/spotify/src/bin/badger.rs:78:10

Originally created by @gdesmott on GitHub (Jan 23, 2022). Original GitHub issue: https://github.com/librespot-org/librespot/issues/943 Trying to retrieve album metadata using the `new-api` branch raises this crash. ```rust let album_id = SpotifyId::from_uri("spotify:album:2iUX7KsTPIjAUuQfp8Wf49").unwrap(); let album = librespot::metadata::Album::get(&session, album_id) .await .unwrap(); dbg!(&album); ``` ``` [2022-01-23T21:07:06Z TRACE librespot_metadata] Received metadata: gid: "K\275WO\202\332D\021\246\260\271\210\215\202\037\215" name: "Ding Dong Song" artist { gid: "\265\326\230\036\n|H\030\246f6\313_\336D\360" name: "G\303\274nther" } type: SINGLE label: "WM Sweden" date { year: 2004 } popularity: 47 external_id { type: "upc" id: "825646421176" } disc { number: 1 track { gid: "l$o\313\377H@?\255\251\206W9\031\325\226" } track { gid: "g\222\235\233;\031A\272\267\002\217\207\020\327\'M" } track { gid: "D\216\304\234.\227B\200\210J\346uo\314\021\315" } } copyright { type: C text: "\302\251 2004 Warner Music Sweden AB" } copyright { type: P text: "\342\204\227 2004 Warner Music Sweden AB" } cover_group { image { file_id: "\253gam\000\000\036\002b\2639/\320\357\323k\000\006\226\321" size: DEFAULT width: 300 height: 300 } image { file_id: "\253gam\000\000HQb\2639/\320\357\323k\000\006\226\321" size: SMALL width: 64 height: 64 } image { file_id: "\253gam\000\000\262sb\2639/\320\357\323k\000\006\226\321" size: LARGE width: 640 height: 640 } } original_title: "Ding Dong Song" thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: OutOfRange, error: ComponentRange { name: "month", minimum: 1, maximum: 12, value: 0, conditional_range: false } }', audio/spotify/src/bin/badger.rs:78:10 ```
kerem 2026-02-27 19:30:45 +03:00
Author
Owner

@roderickvd commented on GitHub (Jan 23, 2022):

Thanks. That's because this date only contains a year and no month and day. We'll have to deal with that.
Edit: the crash is a result of you calling unwrap of course 😉

<!-- gh-comment-id:1019570794 --> @roderickvd commented on GitHub (Jan 23, 2022): Thanks. That's because this date only contains a year and no month and day. We'll have to deal with that. Edit: the crash is a result of you calling `unwrap` of course 😉
Author
Owner

@roderickvd commented on GitHub (Jan 25, 2022):

Fixed in 3f95a45.

<!-- gh-comment-id:1021512760 --> @roderickvd commented on GitHub (Jan 25, 2022): Fixed in 3f95a45.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#460
No description provided.