[GH-ISSUE #1261] Unable to get client token #577

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

Originally created by @acolombier on GitHub (Mar 10, 2024).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1261

Describe the bug

When using the playlist_tracks.rs example with a large playlist (+300 songs), there is eventually a failure due to a "too many request" exception.

The exception is raised by SpClient::client_token, which seems to constantly fail with a 400 Bad Request, thus gets called at each API request.

To reproduce

Steps to reproduce the behavior:

  1. Build and launch the playlist_tracks.rs example with a large playlist (+300 songs)
  2. See error

Log

...
2024-03-10T00:07:05Z DEBUG librespot_core::spclient] Client token unavailable or expired, requesting new token.
[2024-03-10T00:07:05Z DEBUG librespot_core::http_client] Requesting https://clienttoken.spotify.com/v1/clienttoken
[2024-03-10T00:07:05Z DEBUG hyper::client::pool] reuse idle connection for ("https", clienttoken.spotify.com)
[2024-03-10T00:07:05Z DEBUG h2::codec::framed_write] send frame=Headers { stream_id: StreamId(419), flags: (0x4: END_HEADERS) }
[2024-03-10T00:07:05Z DEBUG h2::codec::framed_write] send frame=Data { stream_id: StreamId(419), flags: (0x1: END_STREAM) }
[2024-03-10T00:07:05Z DEBUG h2::codec::framed_read] received frame=Headers { stream_id: StreamId(419), flags: (0x5: END_HEADERS | END_STREAM) }
[2024-03-10T00:07:05Z DEBUG h2::codec::framed_read] received frame=Ping { ack: false, payload: [0, 0, 0, 0, 0, 0, 4, 101] }
[2024-03-10T00:07:05Z DEBUG h2::codec::framed_write] send frame=Ping { ack: true, payload: [0, 0, 0, 0, 0, 0, 4, 101] }
[2024-03-10T00:07:05Z WARN  librespot_core::spclient] Unable to get client token: Client specified an invalid argument { Response status code: 400 Bad Request } Trying to continue without...
[2024-03-10T00:07:05Z DEBUG librespot_core::http_client] Requesting https://gew1-spclient.spotify.com:443/metadata/4/track/...?product=0&country=GB&salt=436026428
...

Host (what you are running librespot on):

  • OS: Linux
  • Platform: amd64
  • Version: dev
Originally created by @acolombier on GitHub (Mar 10, 2024). Original GitHub issue: https://github.com/librespot-org/librespot/issues/1261 **Describe the bug** When using the `playlist_tracks.rs` example with a large playlist (+300 songs), there is eventually a failure due to a "too many request" exception. The exception is raised by `SpClient::client_token`, which seems to constantly fail with a `400 Bad Request`, thus gets called at each API request. **To reproduce** Steps to reproduce the behavior: 1. Build and launch the `playlist_tracks.rs` example with a large playlist (+300 songs) 2. See error **Log** ``` ... 2024-03-10T00:07:05Z DEBUG librespot_core::spclient] Client token unavailable or expired, requesting new token. [2024-03-10T00:07:05Z DEBUG librespot_core::http_client] Requesting https://clienttoken.spotify.com/v1/clienttoken [2024-03-10T00:07:05Z DEBUG hyper::client::pool] reuse idle connection for ("https", clienttoken.spotify.com) [2024-03-10T00:07:05Z DEBUG h2::codec::framed_write] send frame=Headers { stream_id: StreamId(419), flags: (0x4: END_HEADERS) } [2024-03-10T00:07:05Z DEBUG h2::codec::framed_write] send frame=Data { stream_id: StreamId(419), flags: (0x1: END_STREAM) } [2024-03-10T00:07:05Z DEBUG h2::codec::framed_read] received frame=Headers { stream_id: StreamId(419), flags: (0x5: END_HEADERS | END_STREAM) } [2024-03-10T00:07:05Z DEBUG h2::codec::framed_read] received frame=Ping { ack: false, payload: [0, 0, 0, 0, 0, 0, 4, 101] } [2024-03-10T00:07:05Z DEBUG h2::codec::framed_write] send frame=Ping { ack: true, payload: [0, 0, 0, 0, 0, 0, 4, 101] } [2024-03-10T00:07:05Z WARN librespot_core::spclient] Unable to get client token: Client specified an invalid argument { Response status code: 400 Bad Request } Trying to continue without... [2024-03-10T00:07:05Z DEBUG librespot_core::http_client] Requesting https://gew1-spclient.spotify.com:443/metadata/4/track/...?product=0&country=GB&salt=436026428 ... ```` **Host (what you are running `librespot` on):** - OS: Linux - Platform: amd64 - Version: `dev`
kerem 2026-02-27 19:31:22 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@acolombier commented on GitHub (Mar 19, 2024):

Turns out that this could be fixed by update the Spotify version, Happy to issue a PR if you want?

<!-- gh-comment-id:2008118693 --> @acolombier commented on GitHub (Mar 19, 2024): Turns out that this could be fixed by update the Spotify version, Happy to issue a PR if you want?
Author
Owner

@kingosticks commented on GitHub (Mar 19, 2024):

Yes please, fixing is good

<!-- gh-comment-id:2008170681 --> @kingosticks commented on GitHub (Mar 19, 2024): Yes please, fixing is good
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#577
No description provided.