Skip to content

ElevenLabs TTS entity stays unavailable after a ConnectError at startup (platform setup never retried) #185442

Description

@comdygas2

AI disclosure: This issue was written by Claude (Anthropic's AI model, running in Claude Code) at my request. Claude also did the investigation behind it: reading the logs, profiling, and reading the Home Assistant source. I reviewed it before posting. The measurements and logs are from my own Home Assistant system.

The problem

If the ElevenLabs API can't be reached while the TTS platform is being set up (here: during HA startup, when several cloud integrations were timing out together), tts.elevenlabs_text_to_speech is never created. The config entry still shows Loaded, nothing retries, and the entity stays unavailable until the entry is reloaded by hand. A reload a few minutes later works at once.

Seen at two boots on 2026-10-08 (17:31 and 22:15).

Why it doesn't retry, from the 2026.10.0 source:

  • elevenlabs/__init__.py async_setup_entry catches httpx.ConnectError only around get_model_by_id() (client.models.list()) and turns it into ConfigEntryNotReady. That call succeeded, so the entry finished setup and forwarded its platforms.
  • elevenlabs/tts.py line 68, in the platform's async_setup_entry, then calls client.voices.get_all() with no exception handling.
  • The ConnectError reaches EntityPlatform._async_setup_platform()'s generic except Exception, which logs Error while setting up elevenlabs platform for tts and returns False. Only PlatformNotReady schedules a retry there, so the platform is never set up again, and the already-loaded entry doesn't notice.
  • In the 17:31 case voices.get_all() hung past SLOW_SETUP_MAX_WAIT, so the platform hit the TimeoutError branch ("Startup will proceed without waiting any longer") and returned False; the shielded call then failed with the same ConnectError a few seconds later. Same result: no entity, no retry.

tts.py on dev (checked 2026-10-09) still has the unguarded call.

Possible fix: fetch the voices in __init__.py inside the existing try (so a ConnectError raises ConfigEntryNotReady and the entry retries with backoff) and pass them through runtime_data, or catch ConnectError at tts.py:68 and raise PlatformNotReady. The first fits the pattern entity_platform asks for: it logs an error if a forwarded platform raises ConfigEntryNotReady.

What version of Home Assistant Core has the issue?

core-2026.10.0

What was the last working version of Home Assistant Core?

Unknown. The unguarded voices.get_all() call is not new; it only bites when the API is unreachable at the moment the platform sets up.

What type of installation are you running?

Home Assistant OS (18.3, Home Assistant Green)

Integration causing the issue

ElevenLabs

Link to integration documentation on our website

https://www.home-assistant.io/integrations/elevenlabs/

Diagnostics information

Not available; the integration has no diagnostics platform.

Example YAML snippet

N/A (UI config entry)

Anything in the logs that might be useful for us?

22:15 boot:

2026-10-08 22:15:52.735 WARNING (MainThread) [homeassistant.components.tts] Setup of tts platform elevenlabs is taking over 10 seconds.
2026-10-08 22:15:58.521 ERROR (MainThread) [homeassistant.components.tts] Error while setting up elevenlabs platform for tts: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.14/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.14/site-packages/httpx/_transports/default.py", line 394, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  ...
  File "/usr/local/lib/python3.14/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 499, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/elevenlabs/tts.py", line 68, in async_setup_entry
    voices = (await client.voices.get_all()).voices
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/site-packages/elevenlabs/voices/client.py", line 655, in get_all
    _response = await self._raw_client.get_all(show_legacy=show_legacy, request_options=request_options)
  File "/usr/local/lib/python3.14/site-packages/elevenlabs/voices/raw_client.py", line 696, in get_all
    _response = await self._client_wrapper.httpx_client.request(
  File "/usr/local/lib/python3.14/site-packages/elevenlabs/core/http_client.py", line 477, in request
    response = await self.httpx_client.request(
  File "/usr/local/lib/python3.14/site-packages/httpx/_client.py", line 1540, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.14/site-packages/httpx/_client.py", line 1629, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.14/site-packages/httpx/_client.py", line 1657, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.14/site-packages/httpx/_client.py", line 1694, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.14/site-packages/httpx/_client.py", line 1730, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.14/site-packages/httpx/_transports/default.py", line 393, in handle_async_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.14/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError

17:31 boot:

2026-10-08 17:31:09.634 WARNING (MainThread) [homeassistant.components.tts] Setup of tts platform elevenlabs is taking over 10 seconds.
2026-10-08 17:31:34.687 ERROR (MainThread) [homeassistant.components.tts] Setup of platform elevenlabs is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2026-10-08 17:31:42.970 ERROR (MainThread) [homeassistant] Error doing job: ConnectError exception in shielded future (task: None)
Traceback (most recent call last):
  ...
httpx.ConnectError
  (same chain as above: elevenlabs/tts.py line 68 → voices.get_all → httpx)

Additional information

Activity

  1. home-assistant commented on Oct 9, 2026

    @home-assistant
    Contributor

    Hey there @sorgfresser, mind taking a look at this issue as it has been labeled with an integration (elevenlabs) you are listed as a code owner for? Thanks!

    Code owner commands

    Code owners of elevenlabs can trigger bot actions by commenting:

    • @home-assistant close Closes the issue.
    • @home-assistant rename Awesome new title Renames the issue.
    • @home-assistant reopen Reopen the issue.
    • @home-assistant unassign elevenlabs Removes the current integration label and assignees on the issue, add the integration domain after the command.
    • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the issue.
    • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the issue.

    (message by CodeOwnersMention)


    @comdygas2 Thanks for reporting this issue!

    Before we dive in, please make sure this isn't a duplicate by searching through existing issues. Also check recently closed issues, as your problem might already be fixed but not yet released.

    https://github.com/home-assistant/core/issues?q=%20label%3A%22integration%3A%20elevenlabs%22%20
    (message by IssueContext)


    elevenlabs documentation
    elevenlabs source
    (message by IssueLinks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions