music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.35k stars 52 forks source link

Spotify errors since core 23.1.4 update #1069

Closed erkr closed 1 year ago

erkr commented 1 year ago

What version of Music Assistant has the issue?

2022.12.1

The problem

I noticed some errors in my log since the core 2023.1.4 update. I’m still able to play music from Spotify though. But when starting music there are errors lifted as well.

How to reproduce

-

Relevant log output

two errors after the update:

Logger: music_assistant.music.spotify
Source: runner.py:120 
First occurred: 15:02:40 (1 occurrences) 
Last logged: 15:02:40

me/following - 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('https://api.spotify.com/v1/me/following?type=artist&limit=50&market=from_token&country=from_token')

And

Logger: music_assistant
Source: /usr/local/lib/python3.10/site-packages/music_assistant/mass.py:232 
First occurred: 15:02:40 (1 occurrences) 
Last logged: 15:02:40

Job [Library sync for provider Spotify] failed with error 'NoneType' object is not subscriptable.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/music_assistant/models/music_provider.py", line 402, in sync_library
    async for prov_item in self._get_library_gen(media_type)():
  File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/spotify/spotify.py", line 145, in get_library_artists
    for item in spotify_artists["artists"]["items"]:
TypeError: 'NoneType' object is not subscriptable

Then when I started a playlist, the same error popped up again:

This error originated from a custom integration.

Logger: music_assistant.music.spotify
Source: custom_components/mass/websockets.py:929 
Integration: Music Assistant (documentation, issues) 
First occurred: 15:06:46 (2 occurrences) 
Last logged: 15:07:55

me/following - 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('https://api.spotify.com/v1/me/following?type=artist&limit=50&market=from_token&country=from_token')

Followed by another error:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/mass/websockets.py:929 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 15:06:46 (2 occurrences) 
Last logged: 15:07:55

[547420392320] Error handling message: Unknown error (unknown_error) from 192.168.178.27 (Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2022.10.1 (io.robbie.HomeAssistant; build:2022.424; iOS 16.2.0) Mobile/HomeAssistant, like Safari)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/config/custom_components/mass/websockets.py", line 114, in async_get_mass_func
    await orig_func(hass, connection, msg, mass)
  File "/config/custom_components/mass/websockets.py", line 929, in websocket_browse
    await mass.music.browse(msg.get("path")),
  File "/usr/local/lib/python3.10/site-packages/music_assistant/controllers/music.py", line 224, in browse
    return await prov.browse(path)
  File "/usr/local/lib/python3.10/site-packages/music_assistant/models/music_provider.py", line 338, in browse
    items=[x async for x in self.get_library_artists()],
  File "/usr/local/lib/python3.10/site-packages/music_assistant/models/music_provider.py", line 338, in <listcomp>
    items=[x async for x in self.get_library_artists()],
  File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/spotify/spotify.py", line 145, in get_library_artists
    for item in spotify_artists["artists"]["items"]:
TypeError: 'NoneType' object is not subscriptable

Additional information

-

What version of Home Assistant Core are your running

Core 2023.1.4

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

erkr commented 1 year ago

Maybe the start of these errors after the core-2023.1.4 update was a coincidence. Saw a similar issue with Spotify in core: https://github.com/home-assistant/core/issues/85833 There they suggest there was some change in the API

smarthomefamilyverrips commented 1 year ago

I still get same errors as in https://github.com/home-assistant/core/issues/85833

Logger: spotipy.client Source: components/spotify/media_player.py:363 First occurred: 16:14:20 (1 occurrences) Last logged: 16:14:20

Max Retries reached

Logger: homeassistant.components.spotify Source: helpers/update_coordinator.py:168 Integration: Spotify (documentation, issues) First occurred: 16:09:48 (1 occurrences) Last logged: 16:09:48

Error fetching SesameMadness Devices data:

lukbe commented 1 year ago

I have same problem....

2023-01-16 10:38:55.983 ERROR (SyncWorker_5) [spotipy.client] Max Retries reached 2023-01-16 10:50:56.004 ERROR (SyncWorker_7) [spotipy.client] Max Retries reached 2023-01-16 12:58:26.264 ERROR (SyncWorker_3) [spotipy.client] Max Retries reached

erkr commented 1 year ago

@lukbe @smarthomefamilyverrips I guess your remarks in this thread are not music assistant related! If so please continue to post them in the original core issue: https://github.com/home-assistant/core/issues/85833

I just referenced that core issue, because the root cause can be the same. Best Eric

smarthomefamilyverrips commented 1 year ago

@erkr OK will keep this for the other post 👍🏻

erkr commented 1 year ago

Seems resolved after I updated to core 2023.1.5 today!