Error when executing spotcast.start


I have this simple script :

alias: Spotify search
  - service: spotcast.start
      search: "{{ states('input_text.text_spotify_search') }}"
      random_song: true
      shuffle: true
      device_name: ChromecastAudioLiving
mode: single

When I call that script I now get this error :

Logger: homeassistant.components.script.spotify_search
Source: helpers/
Integration: Script (documentation, issues)
First occurred: 16:50:43 (1 occurrences)
Last logged: 16:50:43

Spotify search: Error executing script. Unexpected error for call_service at pos 1: 'float' object cannot be interpreted as an integer
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
  File "/usr/src/homeassistant/homeassistant/helpers/", line 685, in _async_run_long_action
    return long_task.result()
  File "/usr/src/homeassistant/homeassistant/", line 2279, in async_call
    response_data = await coro
  File "/usr/src/homeassistant/homeassistant/", line 2323, in _execute_service
    return await self._hass.async_add_executor_job(target, service_call)
  File "/usr/local/lib/python3.12/concurrent/futures/", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/spotcast/", line 256, in start_casting
  File "/config/custom_components/spotcast/", line 365, in play
    position = random.randint(0, results["total"] - 1)
  File "/usr/local/lib/python3.12/", line 336, in randint
    return self.randrange(a, b+1)
  File "/usr/local/lib/python3.12/", line 312, in randrange
    istop = _index(stop)
TypeError: 'float' object cannot be interpreted as an integer

Any idea ?

Thank you very much !