MPD media_player error: URL is relative, but does not start with a /

Hello!

After the update to 2022.4, my MPD player fails to receive a service call.

I trigger it via:

service: media_player.play_media
data:
  media_content_id: door.mp3
  media_content_type: music
target:
  entity_id: media_player.mpd

Here’s the error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1634, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1671, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 282, in service_handler
    await script_entity.async_turn_on(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 386, in async_turn_on
    await coro
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 412, in _async_run
    return await self.script.async_run(script_vars, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1275, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 359, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 379, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 582, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1634, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1671, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 677, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 955, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 714, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 479, in async_play_media
    media_id = async_process_play_media_url(self.hass, media_id)
  File "/usr/src/homeassistant/homeassistant/components/media_player/browse_media.py", line 40, in async_process_play_media_url
    raise ValueError("URL is relative, but does not start with a /")
ValueError: URL is relative, but does not start with a /

The underlying media_player is the MPD add-on, when I click the play button over its GUI, the sound is being played with no problem.

This issue did not occur with 2022.3.

Yes confirm. I have the same after updating to 2022.4.1

- service: media_player.play_media
      data:
       media_content_id: door_bell_1.mp3
       media_content_type: music
      target:
       entity_id: media_player.aqara

This file is located in the directory /mpd/music/door_bell_1.mp3
Tried like this:

- service: media_player.play_media
      data:
       media_content_id: /mpd/music/door_bell_1.mp3
       media_content_type: music
      target:
       entity_id: media_player.aqara

Same error

This bug is submitted here Invalid Media ID on MPD · Issue #69601 · home-assistant/core · GitHub

Fixed in 2022.4.3. Thanks!

Hi, I have this problem, but on version “Home Assistant Core 2022.5.4”:

Stopped because an error was encountered at August 4, 2022 at 11:02:07 AM (runtime: 0.05 seconds)

URL is relative, but does not start with a /

How can this be? What am I missing? 😵‍💫

Thanks!

Having the same issue now.

I seem to be having the same issue and then noticed that the mpd player state is “off”.
Screenshot from 2022-10-06 18-41-28

The mpd player is working when I try from the command line.

Does this mean that mpd player got setup in HA or does it mean that the service call to it is not going through?