[GH-ISSUE #502] HttpTransport "TimedOut" error with Search example #163

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

Originally created by @raleighlittles on GitHub (Nov 17, 2024).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/502

Describe the bug
A clear and concise description of what the bug is.

Trying to run a very simple album query example and encountering this error.

called `Result::unwrap()` on an `Err` value: Http(Transport(Transport { kind: Io, message: None, url: Some(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("accounts.spotify.com")), port: None, path: "/api/token", query: None, fragment: None }), source: Some(Custom { kind: TimedOut, error: "timed out reading response" }) }))

To Reproduce

Code snippet:

// main.rs
use rspotify::clients::BaseClient;
use rspotify::model::SearchType;

fn main() {
    println!("Loading credentials from .env file ..");
    let creds_from_env_file = rspotify::Credentials::from_env().unwrap();
    println!("Credentials loaded! Creating client obj.. ");
    let spotify_cli_obj = rspotify::ClientCredsSpotify::new(creds_from_env_file);

    // Obtaining the access token - must be done before any query is made
    spotify_cli_obj.request_token().unwrap();

    let album_query = "album:arrival artist:abba";
    let result = spotify_cli_obj.search(album_query, SearchType::Album, None, None, Some(10), None);
    match result {
        Ok(album) => println!("Searched album: {album:?}"),
        Err(err) => println!("Search error! {err:?}"),
    }
}

My Cargo.toml file:

[package]
name = "to_spotify"
version = "0.1.0"
edition = "2021"

[dependencies]
rspotify = { version = "0.13.3",default-features = false,features = ["env-file", "client-ureq", "ureq-rustls-tls"]}
dotenv = "0.15.0"

My version info:

info: The currently active `rustc` version is `rustc 1.82.0 (f6e511eec 2024-10-15)`
cargo 1.82.0 (8f40fc59f 2024-08-21)

I have the usual Rust folder structure

├── Cargo.lock
├── Cargo.toml
├── .env
├── README.md
└── src
    └── main.rs

2 directories, 5 files

and my env file has RSPOTIFY_CLIENT_ID and RSPOTIFY_CLIENT_SECRET defined that I got from the spotify developer dashboard here https://developer.spotify.com/dashboard/

Originally created by @raleighlittles on GitHub (Nov 17, 2024). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/502 **Describe the bug** A clear and concise description of what the bug is. Trying to run a very simple album query example and encountering this error. ``` called `Result::unwrap()` on an `Err` value: Http(Transport(Transport { kind: Io, message: None, url: Some(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("accounts.spotify.com")), port: None, path: "/api/token", query: None, fragment: None }), source: Some(Custom { kind: TimedOut, error: "timed out reading response" }) })) ``` **To Reproduce** Code snippet: ```rust // main.rs use rspotify::clients::BaseClient; use rspotify::model::SearchType; fn main() { println!("Loading credentials from .env file .."); let creds_from_env_file = rspotify::Credentials::from_env().unwrap(); println!("Credentials loaded! Creating client obj.. "); let spotify_cli_obj = rspotify::ClientCredsSpotify::new(creds_from_env_file); // Obtaining the access token - must be done before any query is made spotify_cli_obj.request_token().unwrap(); let album_query = "album:arrival artist:abba"; let result = spotify_cli_obj.search(album_query, SearchType::Album, None, None, Some(10), None); match result { Ok(album) => println!("Searched album: {album:?}"), Err(err) => println!("Search error! {err:?}"), } } ``` My Cargo.toml file: ```toml [package] name = "to_spotify" version = "0.1.0" edition = "2021" [dependencies] rspotify = { version = "0.13.3",default-features = false,features = ["env-file", "client-ureq", "ureq-rustls-tls"]} dotenv = "0.15.0" ``` My version info: ``` info: The currently active `rustc` version is `rustc 1.82.0 (f6e511eec 2024-10-15)` cargo 1.82.0 (8f40fc59f 2024-08-21) ``` I have the usual Rust folder structure ``` ├── Cargo.lock ├── Cargo.toml ├── .env ├── README.md └── src └── main.rs 2 directories, 5 files ``` and my env file has `RSPOTIFY_CLIENT_ID` and `RSPOTIFY_CLIENT_SECRET` defined that I got from the spotify developer dashboard here https://developer.spotify.com/dashboard/
kerem 2026-02-27 20:23:30 +03:00
Author
Owner

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

Based on the error message "timed out reading response" from accounts.spotify.com, this appears to be a network connectivity issue rather than a bug in RSpotify, This is likely a local network/connectivity problem rather than an issue with the RSpotify library itself.

<!-- gh-comment-id:3049759766 --> @ramsayleung commented on GitHub (Jul 8, 2025): Based on the error message "timed out reading response" from accounts.spotify.com, this appears to be a network connectivity issue rather than a bug in `RSpotify`, This is likely a local network/connectivity problem rather than an issue with the `RSpotify` library itself.
Author
Owner

@raleighlittles commented on GitHub (Jul 10, 2025):

I was actually able to get it working using Spotipy, the Python library instead. https://spotipy.readthedocs.io/en/2.25.1/ so I'm not sure it was a network issue

<!-- gh-comment-id:3058309331 --> @raleighlittles commented on GitHub (Jul 10, 2025): I was actually able to get it working using Spotipy, the Python library instead. https://spotipy.readthedocs.io/en/2.25.1/ so I'm not sure it was a network issue
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#163
No description provided.