[GH-ISSUE #489] Json Parsing error internal #161

Closed
opened 2026-02-27 20:23:29 +03:00 by kerem · 2 comments
Owner

Originally created by @Jacob-Tate on GitHub (Aug 9, 2024).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/489

Describe the bug
When attempting to use the show query code I get the following error this doesnt occur on the track search

To Reproduce

let creds = Credentials::new("redacted","redacted");
let client = ClientCredsSpotify::new(creds);
client.request_token().await.unwrap();

let show_query = "love";
let result = client.search(show_query, SearchType::Show, None, None, Some(10), None).await;
match result {
     Ok(show) => println!("Searched show: {show:?}"),
     Err(err) => println!("Search error! {err:?}"),
}

Log/Output data
Search error! ParseJson(Error("invalid type: null, expected struct SimplifiedShow", line: 4, column: 20))

Originally created by @Jacob-Tate on GitHub (Aug 9, 2024). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/489 **Describe the bug** When attempting to use the show query code I get the following error this doesnt occur on the track search **To Reproduce** ```rust let creds = Credentials::new("redacted","redacted"); let client = ClientCredsSpotify::new(creds); client.request_token().await.unwrap(); let show_query = "love"; let result = client.search(show_query, SearchType::Show, None, None, Some(10), None).await; match result { Ok(show) => println!("Searched show: {show:?}"), Err(err) => println!("Search error! {err:?}"), } ``` **Log/Output data** `Search error! ParseJson(Error("invalid type: null, expected struct SimplifiedShow", line: 4, column: 20))`
kerem 2026-02-27 20:23:29 +03:00
Author
Owner

@ramsayleung commented on GitHub (Sep 13, 2024):

I can reproduce this problem with curl:

·> curl --request GET \
  --url 'https://api.spotify.com/v1/search?limit=10&q=love&type=show' \
  --header 'Authorization: Bearer MyToken'
{
  "shows" : {
    "href" : "https://api.spotify.com/v1/search?query=love&type=show&offset=0&limit=10",
    "items" : [ null, null, null, null, null, null, null, null, null, null ],
    "limit" : 10,
    "next" : "https://api.spotify.com/v1/search?query=love&type=show&offset=10&limit=10",
    "offset" : 0,
    "previous" : null,
    "total" : 209
  }
}%

According to the Spotify's document:

If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.
Note: If neither market or user country are provided, the content is considered unavailable for the client.
Users can view the country that is associated with their account in the account settings.

You have not specified any country in your request, it means Spotify was using the country associated with your account, if you haven't set a country in your account setting, no show is available for you, so it return list of null.

In order to fix the above problem, you could simply specify a country like market=US

<!-- gh-comment-id:2348205005 --> @ramsayleung commented on GitHub (Sep 13, 2024): I can reproduce this problem with curl: ``` ·> curl --request GET \ --url 'https://api.spotify.com/v1/search?limit=10&q=love&type=show' \ --header 'Authorization: Bearer MyToken' { "shows" : { "href" : "https://api.spotify.com/v1/search?query=love&type=show&offset=0&limit=10", "items" : [ null, null, null, null, null, null, null, null, null, null ], "limit" : 10, "next" : "https://api.spotify.com/v1/search?query=love&type=show&offset=10&limit=10", "offset" : 0, "previous" : null, "total" : 209 } }% ``` According to the Spotify's [document](https://developer.spotify.com/documentation/web-api/reference/search): > If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. > Note: If neither market or user country are provided, the content is considered unavailable for the client. Users can view the country that is associated with their account in the [account settings](https://www.spotify.com/account/overview/). You have not specified any country in your request, it means Spotify was using the country associated with your account, if you haven't set a country in your account setting, no show is available for you, so it return list of `null`. In order to fix the above problem, you could simply specify a country like `market=US`
Author
Owner

@ramsayleung commented on GitHub (Jul 8, 2025):

This problem should be fixed by this PR https://github.com/ramsayleung/rspotify/pull/526/files, you could consume the 0.15.0 to solve this problem.

<!-- gh-comment-id:3049763739 --> @ramsayleung commented on GitHub (Jul 8, 2025): This problem should be fixed by this PR https://github.com/ramsayleung/rspotify/pull/526/files, you could consume the `0.15.0` to solve this problem.
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/rspotify#161
No description provided.