Failed to call service script. Error: No active player

Hi, I have a script to turn on TV, switch input to Kodi and play a playlist on it. But sometimes (seemingly randomly), it doesn’t work and gives me this:

Failed to call service script/turn_on_tv_and_kodi. Error: No active player.

The log entry is here and the script is here.

Any idea? Thanks.

You don’t have to use external code posting sites on the forum. Paste them inside code blocks here.

Nobody? Problem still stands. “No active player” when calling a Kodi playlist. There was no Kodi update and the script worked before.

Still not fixed. Now with 2022.4 it’s an issue even with different integrations such as Spotify, Sonos, Alexa Media Player.

Still an issue as of August 2023. I’m trying to play media to Kodi, I get “no active player”.

Not an answer to your question, but a suggestion: re-read the post from tom_I and directly paste your code and logs in a forum post here.
Using external posting sites for code is not user friendly and could potentially be a security risk.

Edit:
Ah! I just saw that you in fact did this 18 minutes ago, so good for you.

1 Like

Right, okay

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 659, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1569, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 242, in wrapper
await func(obj, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 749, in async_set_shuffle
raise RuntimeError("Error: No active player.")
RuntimeError: Error: No active player.