dry-rainbow-66344
09/04/2025, 4:26 AM2025-09-04 04:24:58,225 - ERROR livekit.agents - Error in _tts_inference_task
Traceback (most recent call last):
File "/root/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py", line 529, in __anext__
val = await self._event_aiter.__anext__()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopAsyncIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py", line 71, in async_wrapper
return await func(*args, **kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.venv/lib/python3.13/site-packages/livekit/agents/voice/generation.py", line 212, in _tts_inference_task
async for audio_frame in tts_node:
...<3 lines>...
audio_ch.send_nowait(audio_frame)
File "/root/.venv/lib/python3.13/site-packages/livekit/agents/voice/agent.py", line 412, in tts_node
async for ev in stream:
yield ev.frame
File "/root/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py", line 532, in __anext__
raise exc # noqa: B904
^^^^^^^^^
File "/root/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py", line 71, in async_wrapper
return await func(*args, **kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py", line 357, in _main_task
await self._run(output_emitter)
File "/root/.venv/lib/python3.13/site-packages/livekit/plugins/google/tts.py", line 339, in _run
await asyncio.gather(*tasks)
File "/root/.venv/lib/python3.13/site-packages/livekit/plugins/google/tts.py", line 332, in _run_segments
await self._run_stream(input_stream, output_emitter, streaming_config)
File "/root/.venv/lib/python3.13/site-packages/livekit/plugins/google/tts.py", line 367, in _run_stream
stream = await self._tts._ensure_client().streaming_synthesize(
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/root/.venv/lib/python3.13/site-packages/livekit/plugins/google/tts.py", line 202, in _ensure_client
self._client = texttospeech.TextToSpeechAsyncClient(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
client_options=ClientOptions(api_endpoint=api_endpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/root/.venv/lib/python3.13/site-packages/google/cloud/texttospeech_v1/services/text_to_speech/async_client.py", line 264, in __init__
self._client = TextToSpeechClient(
~~~~~~~~~~~~~~~~~~^
credentials=credentials,
^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
client_info=client_info,
^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/root/.venv/lib/python3.13/site-packages/google/cloud/texttospeech_v1/services/text_to_speech/client.py", line 679, in __init__
self._transport = transport_init(
~~~~~~~~~~~~~~^
credentials=credentials,
^^^^^^^^^^^^^^^^^^^^^^^^
...<7 lines>...
api_audience=self._client_options.api_audience,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/root/.venv/lib/python3.13/site-packages/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py", line 282, in __init__
super().__init__(
~~~~~~~~~~~~~~~~^
host=host,
^^^^^^^^^^
...<6 lines>...
api_audience=api_audience,
^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/root/.venv/lib/python3.13/site-packages/google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py", line 104, in __init__
credentials, _ = google.auth.default(
~~~~~~~~~~~~~~~~~~~^
**scopes_kwargs, quota_project_id=quota_project_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/root/.venv/lib/python3.13/site-packages/google/auth/_default.py", line 651, in default
credentials, project_id = checker()
~~~~~~~^^
File "/root/.venv/lib/python3.13/site-packages/google/auth/_default.py", line 644, in <lambda>
lambda: _get_explicit_environ_credentials(quota_project_id=quota_project_id),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.venv/lib/python3.13/site-packages/google/auth/_default.py", line 293, in _get_explicit_environ_credentials
credentials, project_id = load_credentials_from_file(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
os.environ[environment_vars.CREDENTIALS], quota_project_id=quota_project_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/root/.venv/lib/python3.13/site-packages/google/auth/_default.py", line 125, in load_credentials_from_file
raise exceptions.DefaultCredentialsError(
"File {} was not found.".format(filename)
)tall-airline-16756
09/04/2025, 4:26 AMtall-airline-16756
09/04/2025, 4:26 AMDefaultCredentialsError, pops up when Google Cloud TTS can't find the right credentials. No worries though—here’s a simple way to fix it:
1. Double-check where your credentials are coming from: Make sure you’re providing credentials through one of these options:
◦ Pass a credentials_file parameter with the path to your JSON service account key file.
◦ Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your JSON key file.
◦ Use Application Default Credentials (ADC) by running gcloud auth application-default login.
1. Make sure the API is enabled: Check that the Google Cloud Text-to-Speech API is turned on for your project. You can do this by running:
gcloud services enable texttospeech.googleapis.com
2. Check your permissions: Confirm that your service account has the roles/speech.user IAM role assigned.
3. Verify the file path: If you’re using credentials_file, double-check that the file actually exists and is readable.
4. Try testing with explicit credentials: For a quick debug, you can pass the credentials directly in your code like this:
import json
with open("service-account-key.json") as f:
creds = json.load(f)
tts = google.TTS(credentials_info=creds)
Give these steps a shot, and you should be all set! If you run into any more trouble or have questions, just let me know—I’m here to help.
Sources: Gemini TTS integration guide | LiveKit Docs | plugins/google/src/beta/gemini_tts.ts | Google Cloud TTS integration guide | LiveKit Docs | Google integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-groq/livekit/plugins/groq/tts.py