Invalid media type: music

Hello,

since a couple of weeks I am suddenly unable to play music via Home Assistant. This affects both local files through “Media” and MusicAssistant.

The logs show the following error:

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/websocket_api/commands.py:245
Integration: Home Assistant WebSocket API (Dokumentation, Probleme)
Erstmals aufgetreten: 19:41:18 (2 Vorkommnisse)
Zuletzt protokolliert: 19:41:22

[281471877582416] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2794, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/braviatv/media_player.py", line 265, in async_play_media
    await self.coordinator.async_play_media(media_type, media_id, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/braviatv/coordinator.py", line 58, in wrapper
    await func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/braviatv/coordinator.py", line 331, in async_play_media
    raise ValueError(f"Invalid media type: {media_type}")
ValueError: Invalid media type: music

This was working before, however I can’t say which action broke the functionality for me.

I am hoping someone can help me here.

Kind regards

Try album, artist, track, podcast, playlist, or audiobook

I was working with a music search intent last night and I dont remember ‘music’ being a valid option, it needed to be more precise.

Thanks for your quick response, but this also happens if I open the media browser and just click on any arbitrary mp3 file to be played. I am not explicitly setting the media type myself. The log suggests that the type is set as part of the downstream functionality of HA core…

Maybe important to mention that it does not happen if I set as playback device the webbrowser. So this may be related to my media_player entity of my TV being broken?

1 Like

Indeed this only happens with the music assistant media player entities. I can see in the MASS logs:

2025-03-08 20:40:57.018 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved
Traceback (most recent call last):
  File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/players.py", line 101, in wrapper
    await func(self, *args, **kwargs)
  File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/players.py", line 712, in play_media
    await player_prov.play_media(
  File "/app/venv/lib/python3.12/site-packages/music_assistant/providers/hass_players/__init__.py", line 316, in play_media
    await self.hass_prov.hass.call_service(
  File "/app/venv/lib/python3.12/site-packages/hass_client/client.py", line 184, in call_service
    return await self.send_command("call_service", **params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.12/site-packages/hass_client/client.py", line 225, in send_command
    return await future
           ^^^^^^^^^^^^
hass_client.exceptions.FailedCommand: Invalid media type: music
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/player_queues.py", line 814, in play_media
    await self.mass.players.play_media(
  File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/players.py", line 103, in wrapper
    raise PlayerCommandFailed(str(err)) from err
music_assistant_models.errors.PlayerCommandFailed: Invalid media type: music