librespot: Playing from artist often causes a crash

I’m trying to play music from an artist, for example by doing a call to the Web API using me/player/play with spotify:artist:70BYFdaZbEKbeauJ670ysI, although, any artist seem to cause issues. A couple of tracks usually play fine, but after a short while, librespot seems to crash pretty consistently with a similar error message each time:

thread 'main' panicked at 'attempt to subtract with overflow', core/src/spotify_id.rs:121:20

Only happens when playing from any artist, anything else seems to work just fine. Playing from artist works poorly in general, as it only seems to play a few tracks, maybe related?

stack_backtrace.log

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 20 (15 by maintainers)

Most upvoted comments

It’s been a while, so I might be wrong here add a pinch of healthy scepticism 😉

playing_from_fallback: true – that gives us the first clue, since we are on the old API, server sends a Frame with only a few “fallback” tracks.

But it looks like the desktop client does something different – after the first 24 tracks, it adds more tracks by the same artist This is different than our current flow, which essentially boils down to hm:autoplay-enabled that yields spotify:station:artist:70BYFdaZbEKbeauJ670ysI. This would then populate a station (dynamic playlist) with multiple artists.

I fear this might be something that needs the new API and digging into @devgianlu’s reverse engineering…

Maybe you’d like to try out my proposed fix