[GH-ISSUE #1194] Indefinite Hang given an invalid Client_ID #699

Closed
opened 2026-02-28 00:00:58 +03:00 by kerem · 1 comment
Owner

Originally created by @AtomikkuLabs on GitHub (Apr 24, 2025).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1194

Describe the bug
An extension of https://github.com/spotipy-dev/spotipy/issues/957, this is an old issue that somehow is not resolved. When an invalid client_id is provided, a browser windows pops up saying "INVALID_CLIENT: Invalid client" but spotipy acts as if everything is normal. If you then proceed do anything such as sp.current_playback(), it causes the program to hang. The only solution I see having right now is a function with a timeout, however, this is not ideal. Spotipy should raise an exception when a client_id is invalid right?

Your code

redirect_uri = "http://127.0.0.1:5000/callback"
scope = "user-read-playback-state"

print("Begin")
auth_manager = spotipy.SpotifyPKCE(client_id=client_id, redirect_uri=redirect_uri, scope=scope)
print("1")
spotify = spotipy.Spotify(auth_manager=auth_manager)
print("2")
spotify.current_playback()
print("3")

Expected behavior
I expect, given an invalid client_id, for an exception to be raised

Output
Begin, 1, and 2 are printed but 3 is never reached as the program hangs.

Environment:

  • OS: Windows 11
  • Python version 3.11
  • spotipy version 2.25.1
  • PyCharm
Originally created by @AtomikkuLabs on GitHub (Apr 24, 2025). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1194 **Describe the bug** An extension of https://github.com/spotipy-dev/spotipy/issues/957, this is an old issue that somehow is not resolved. When an invalid client_id is provided, a browser windows pops up saying "INVALID_CLIENT: Invalid client" but spotipy acts as if everything is normal. If you then proceed do anything such as sp.current_playback(), it causes the program to hang. The only solution I see having right now is a function with a timeout, however, this is not ideal. Spotipy should raise an exception when a client_id is invalid right? **Your code** ``` redirect_uri = "http://127.0.0.1:5000/callback" scope = "user-read-playback-state" print("Begin") auth_manager = spotipy.SpotifyPKCE(client_id=client_id, redirect_uri=redirect_uri, scope=scope) print("1") spotify = spotipy.Spotify(auth_manager=auth_manager) print("2") spotify.current_playback() print("3") ``` **Expected behavior** I expect, given an invalid client_id, for an exception to be raised **Output** Begin, 1, and 2 are printed but 3 is never reached as the program hangs. **Environment:** - OS: Windows 11 - Python version 3.11 - spotipy version 2.25.1 - PyCharm
kerem 2026-02-28 00:00:58 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@stephanebruckert commented on GitHub (Apr 24, 2025):

Hey! Let's continue on https://github.com/spotipy-dev/spotipy/issues/957 as this is still the same issue. Good to know you are using the latest version though.

<!-- gh-comment-id:2826422723 --> @stephanebruckert commented on GitHub (Apr 24, 2025): Hey! Let's continue on https://github.com/spotipy-dev/spotipy/issues/957 as this is still the same issue. Good to know you are using the latest version though.
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/spotipy#699
No description provided.