-
Notifications
You must be signed in to change notification settings - Fork 128
Description
Hi. I am getting a WSServerHandshakeError: 401, message='Invalid response status when running my agents.py file in dev/start mode to connect with frontend app. It is clearly working in console mode.python agent.py dev
my .env:
LIVEKIT_URL=wss://friday-zagns3xh.livekit.cloud
LIVEKIT_API_KEY=
LIVEKIT_API_SECRET=
OPENAI_API_KEY=
ELEVEN_API_KEY=
error:
2025-09-19 00:01:30,321 - DEBUG asyncio - Using proactor: IocpProactor
2025-09-19 00:01:30,333 - DEV livekit.agents - Watching D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday
2025-09-19 00:01:32,842 - DEBUG asyncio - Using proactor: IocpProactor
2025-09-19 00:01:32,855 - INFO livekit.agents - starting worker {"version": "1.2.9", "rtc-version": "1.0.13"}
2025-09-19 00:01:32,855 - INFO livekit.agents - starting inference executor
2025-09-19 00:01:32,879 - INFO livekit.agents - initializing process {"pid": 53756, "inference": true}
2025-09-19 00:01:35,387 - DEBUG livekit.agents - initializing inference runner {"runner": "lk_end_of_utterance_multilingual", "pid": 53756, "inference": true}
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
2025-09-19 00:01:40,690 - INFO livekit.agents - process initialized {"pid": 53756, "inference": true, "elapsed_time": 7.81}
2025-09-19 00:01:40,690 - DEBUG livekit.agents - inference runner initialized {"runner": "lk_end_of_utterance_multilingual", "elapsed_time": 5.303021100000478, "pid": 53756, "inference": true}
2025-09-19 00:01:40,690 - DEBUG asyncio - Using proactor: IocpProactor {"pid": 53756, "inference": true}
2025-09-19 00:01:41,081 - WARNING livekit.agents - failed to connect to livekit, retrying in 4s
Traceback (most recent call last):
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\worker.py", line 649, in _connection_task
ws = await self._http_session.ws_connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\aiohttp\client.py", line 1084, in _ws_connect
raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 401, message='Invalid response status', url='wss://friday-zagns3xh.livekit.cloud/agent'
2025-09-19 00:01:47,310 - WARNING livekit.agents - failed to connect to livekit, retrying in 6s
RuntimeError: failed to connect to livekit after 16 attempts
2025-09-19 00:03:52,383 - ERROR livekit.agents - worker failed
Traceback (most recent call last):
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\cli_run.py", line 79, in _worker_run
await worker.run()
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\worker.py", line 474, in run
await asyncio.gather(*tasks)
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\worker.py", line 695, in _connection_task
raise RuntimeError(
RuntimeError: failed to connect to livekit after 16 attempts
2025-09-19 00:03:52,390 - INFO livekit.agents - shutting down worker {"id": "unregistered"}
2025-09-19 00:03:52,392 - INFO livekit.agents - process exiting {"reason": "", "pid": 53756, "inference": true}
2025-09-19 00:03:52,941 - ERROR livekit.agents - Error in _read_ipc_task
Traceback (most recent call last):
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 35, in recv_bytes
len_bytes = await self._reader.readexactly(4)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\anandu.ashok\AppData\Local\Programs\Python\Python311\Lib\asyncio\streams.py", line 727, in readexactly
raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 4 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\cli\watcher.py", line 120, in _read_ipc_task
msg = await channel.arecv_message(self._pch, proto.IPC_MESSAGES)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\ipc\channel.py", line 47, in arecv_message
return _read_message(await dplx.recv_bytes(), messages)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\MACHINE LEARNING\LLM\LIVEKIT\friday\friday\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 43, in recv_bytes
raise DuplexClosed() from e
livekit.agents.utils.aio.duplex_unix.DuplexClosed