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.32k stars 48 forks source link

Plex Playlists not loading Content - error [argument of type 'nonetype' is not iterable] #2711

Open aLTeReGo-SWI opened 1 month ago

aLTeReGo-SWI commented 1 month ago

What version of Music Assistant has the issue?

2.1.0

What version of the Home Assistant Integration have you got installed?

2024.7.1.b0

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

Most (not all) Plex playlists never produce any results and return the error 'argument of type 'NoneType' is not iterable'. Full debug Error text below.

2024-08-01 09:41:00.355 ERROR (MainThread) [music_assistant.webserver] Error handling message: CommandMessage(message_id=25, command='music/playlists/playlist_tracks', args={'item_id': '12', 'provider_instance_id_or_domain': 'library', 'force_refresh': False}) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/webserver.py", line 352, in _run_handler result = [x async for x in result] ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/media/playlists.py", line 65, in tracks tracks = await self._get_provider_playlist_tracks( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/media/playlists.py", line 353, in _get_provider_playlist_tracks for item in await provider.get_playlist_tracks(item_id, page=page): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/plex/init.py", line 895, in get_playlist_tracks if track := await self._parse_track(plex_track): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/plex/init.py", line 729, in _parse_track track.album = self._get_item_mapping( ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/plex/init.py", line 428, in _get_item_mapping name, version = parse_title_and_version(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/music_assistant/common/helpers/util.py", line 85, in parse_title_and_version if splitter in title: ^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable

How to reproduce

  1. Click 'Music Assistant' from Home Assistant's left navigation pane
  2. Click 'Playlists' from the bottom Music Assistant panel
  3. Select a Playlist

Music Providers

Plex

Player Providers

UPnP/DLNA Player provider

Full log output

music-assistant.log

Additional information

No response

What version of Home Assistant Core are your running

2024.7.4

What type of installation are you running?

Home Assistant Supervised

On what type of hardware are you running?

Linux

OzGav commented 1 month ago

Please follow the template instructions and replace the pasted log excerpt with an attached full log.

aLTeReGo-SWI commented 1 month ago

@OzGav log file uploaded

OzGav commented 1 month ago

Sorry but that is not the full log. You need to get it from the MA settings

aLTeReGo-SWI commented 1 month ago

@OzGav, apologies for that. Let's try that again. New (hopefully correct) logs uploaded

OzGav commented 1 month ago

@aLTeReGo-SWI Looking at this again. Firstly you have attached the log with DEBUG enabled. We ask you do not do this unless requested. Can you update to the latest version of MA, get this error to occur and then attach the logs WITHOUT debug enabled.

I do note that you have just about every provider enabled. Do you actually use all of those? If not then you should remove the ones you don't use.

marcelveldt commented 1 month ago

I can't reproduce this now on version 2.2.0 so either this is fixed in the series of bugfixes we did last releases or there is some trigger to indice the issue. Can you re-test once you upgraded to version 2.2.0 and let me know if this is still an issue ?

aLTeReGo-SWI commented 1 month ago

Updated to Music Assistant Server 2.2.2 using Music Assistant integration 2024.8.1

@OzGav the only provider(s) I have are shown in the screenshot below.

2024-08-23_17-50-46

Video of issue attached

https://github.com/user-attachments/assets/4e2c4ba2-eb24-4784-9466-da3e7698bd02

Logs collected after errors shown in video

d5369777_music_assistant_2024-08-23T22-58-10.868Z.log

I believe the issue may be related to a simple timeout or reaching some maximum size. The errors only appear on large playlists (hundreds of songs). Smaller playlists with only tens of tracks load just fine without error. If you're unable to reproduce the issue, I'm happy to share my Plex server with you so you can troubleshoot further.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 21 days with no activity. Comment or this will be closed in 7 days.

OzGav commented 3 weeks ago

Not stale