5-08-22 11:13:23,973 - DEBUG - Using proactor: Ioc...
# agents
e
025-08-22 111323,973 - DEBUG - Using proactor: IocpProactor 2025-08-22 111323,973 - DEBUG asyncio - Using proactor: IocpProactor 2025-08-22 111323,973 - INFO - starting worker 2025-08-22 111323,973 - INFO livekit.agents - starting worker {"version": "1.2.6", "rtc-version": "1.0.12"} 2025-08-22 111324,259 - WARNING - failed to connect to livekit, retrying in 0s Traceback (most recent call last): File "D:\Bigagent\venv\Lib\site-packages\livekit\agents\worker.py", line 649, in _connection_task ws = await self._http_session.ws_connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Bigagent\venv\Lib\site-packages\aiohttp\client.py", line 1084, in _ws_connect raise WSServerHandshakeError( aiohttp.client_exceptions.WSServerHandshakeError: 401, message='Invalid response status', url='wss://utkarshpc-9jcqjqam.livekit.cloud/agent' 2025-08-22 111324,259 - WARNING livekit.agents - failed to connect to livekit, retrying in 0s Traceback (most recent call last): File "D:\Bigagent\venv\Lib\site-packages\livekit\agents\worker.py", line 649, in _connection_task ws = await self._http_session.ws_connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Bigagent\venv\Lib\site-packages\aiohttp\client.py", line 1084, in _ws_connect raise WSServerHandshakeError( aiohttp.client_exceptions.WSServerHandshakeError: 401, message='Invalid response status', url='wss://utkarshpc-9jcqjqam.livekit.cloud/agent' 2025-08-22 111324,318 - WARNING - failed to connect to livekit, retrying in 2s Traceback (most recent call last): File "D:\Bigagent\venv\Lib\site-packages\livekit\agents\worker.py", line 649, in _connection_task ws = await self._http_session.ws_connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------------------- this just popup in the console out of blue. same code, same version is running in my another device without any error. i haven't change any env, anything in the code.
1. problem is solved. the issue was time. System Clock Skew (A Strong Possibility): LiveKit authentication tokens (JWTs) are highly time-sensitive. If the system clock on your PC is out of sync with the global time (even by a minute or two), the tokens your agent generates will be considered invalid (either "not yet valid" or "expired") by the LiveKit servers. This is a very common cause for sudden, unexplained
401
errors.
r
Glad you found the issue. Yes tokens are time sensitive.
✅ 1