Skip to content

Google Cloud TTS: en-US voices without language code in the name fail #159982

@thanasibakis

Description

@thanasibakis

The problem

The list of voices for American English seems to unexpectedly contain voices whose names do not have a language code prefix. Attempting to use TTS with these voices fails. Seeing that these voices are all listed before the functioning ones (at least on my machine), this may cause the integration to appear non-functional for American English TTS users. There is no warning in the integration documentation instructing users to avoid these entries.

What version of Home Assistant Core has the issue?

core-2025.12.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Google Cloud

Link to integration documentation on our website

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

Additional information

async_tts_voices returns the following dictionary entry for en-US:

async def async_tts_voices(
client: texttospeech.TextToSpeechAsyncClient,
) -> dict[str, list[str]]:
"""Get TTS voice model names keyed by language."""
voices: dict[str, list[str]] = {}
list_voices_response = await client.list_voices()
for voice in list_voices_response.voices:
language_code = voice.language_codes[0]
if language_code not in voices:
voices[language_code] = []
voices[language_code].append(voice.name)
return voices

{'en-US': ['Achernar', 'Achird', 'Algenib', 'Algieba', 'Alnilam', 'Aoede', 'Autonoe', 'Callirrhoe', 'Charon', 'Despina', 'Enceladus', 'Erinome', 'Fenrir', 'Gacrux', 'Iapetus', 'Kore', 'Laomedeia', 'Leda', 'Orus', 'Puck', 'Pulcherrima', 'Rasalgethi', 'Sadachbia', 'Sadaltager', 'Schedar', 'Sulafat', 'Umbriel', 'Vindemiatrix', 'Zephyr', 'Zubenelgenubi', 'en-US-Casual-K', 'en-US-Chirp-HD-D', 'en-US-Chirp-HD-F', 'en-US-Chirp-HD-O', 'en-US-Chirp3-HD-Achernar', 'en-US-Chirp3-HD-Achird', 'en-US-Chirp3-HD-Algenib', 'en-US-Chirp3-HD-Algieba', 'en-US-Chirp3-HD-Alnilam', 'en-US-Chirp3-HD-Aoede', 'en-US-Chirp3-HD-Autonoe', 'en-US-Chirp3-HD-Callirrhoe', 'en-US-Chirp3-HD-Charon', 'en-US-Chirp3-HD-Despina', 'en-US-Chirp3-HD-Enceladus', 'en-US-Chirp3-HD-Erinome', 'en-US-Chirp3-HD-Fenrir', 'en-US-Chirp3-HD-Gacrux', 'en-US-Chirp3-HD-Iapetus', 'en-US-Chirp3-HD-Kore', 'en-US-Chirp3-HD-Laomedeia', 'en-US-Chirp3-HD-Leda', 'en-US-Chirp3-HD-Orus', 'en-US-Chirp3-HD-Puck', 'en-US-Chirp3-HD-Pulcherrima', 'en-US-Chirp3-HD-Rasalgethi', 'en-US-Chirp3-HD-Sadachbia', 'en-US-Chirp3-HD-Sadaltager', 'en-US-Chirp3-HD-Schedar', 'en-US-Chirp3-HD-Sulafat', 'en-US-Chirp3-HD-Umbriel', 'en-US-Chirp3-HD-Vindemiatrix', 'en-US-Chirp3-HD-Zephyr', 'en-US-Chirp3-HD-Zubenelgenubi', 'en-US-Neural2-A', 'en-US-Neural2-C', 'en-US-Neural2-D', 'en-US-Neural2-E', 'en-US-Neural2-F', 'en-US-Neural2-G', 'en-US-Neural2-H', 'en-US-Neural2-I', 'en-US-Neural2-J', 'en-US-News-K', 'en-US-News-L', 'en-US-News-N', 'en-US-Polyglot-1', 'en-US-Standard-A', 'en-US-Standard-B', 'en-US-Standard-C', 'en-US-Standard-D', 'en-US-Standard-E', 'en-US-Standard-F', 'en-US-Standard-G', 'en-US-Standard-H', 'en-US-Standard-I', 'en-US-Standard-J', 'en-US-Studio-O', 'en-US-Studio-Q', 'en-US-Wavenet-A', 'en-US-Wavenet-B', 'en-US-Wavenet-C', 'en-US-Wavenet-D', 'en-US-Wavenet-E', 'en-US-Wavenet-F', 'en-US-Wavenet-G', 'en-US-Wavenet-H', 'en-US-Wavenet-I', 'en-US-Wavenet-J']}

Selecting a voice for TTS whose name does not begin with a language code fails:

Logger: homeassistant.components.google_cloud.tts
Source: components/google_cloud/tts.py:265
integration: Google Cloud (documentation, issues)
First occurred: 22:56:04 (1 occurrence)
Last logged: 22:56:04

Error occurred during Google Cloud TTS call: 400 Requested language code 'Acher' is not supported for Gemini voices.

I believe the integration assumes all voice names will begin with a language code, from this block:

if not voice.startswith(language):
language = voice[:5]

which is congruent with the above error message portraying 'Acher' as a language code.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions