agents icon indicating copy to clipboard operation
agents copied to clipboard

use vad stream in stt stream sometimes got exception not set at the beginning

Open DeoLeung opened this issue 6 months ago • 4 comments

https://github.com/livekit/agents/blob/main/livekit-agents/livekit/agents/vad.py#L164

Error in send_task
Traceback (most recent call last):
  File "ib/python3.12/site-packages/livekit/agents/vad.py", line 162, in __anext__
    val = await self._event_aiter.__anext__()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopAsyncIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/python3.12/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sttv3.py", line 289, in send_task
    async for event in self._vad_stream:
  File "ib/python3.12/site-packages/livekit/agents/vad.py", line 164, in __anext__
    if not self._task.cancelled() and (exc := self._task.exception()):
                                              ^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.InvalidStateError: Exception is not set.

i'm manually iterating the vad stream in my stt module, but occationally at the start will get this error, any idea of how to avoid this?

DeoLeung avatar Apr 22 '25 03:04 DeoLeung