hi, im getting this error
{"message": "unhandled exception while running the job task\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/opentelemetry/util/_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n File \"/usr/local/lib/python3.10/site-packages/livekit/agents/ipc/job_proc_lazy_main.py\", line 286, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"/opt/deployment/voice-agents-backend/main.py\", line 356, in entrypointx\n await agentToRun.entrypoint(ctx)\n File \"/opt/deployment/voice-agents-backend/screening_assistant.py\", line 2483, in entrypoint\n await session.start(\n File \"/usr/local/lib/python3.10/site-packages/livekit/agents/voice/agent_session.py\", line 595, in start\n raise RuntimeError(\nRuntimeError: Only one `AgentSession` can be the primary at a time. If you want to ignore primary designation, use session.start(record=False).", "level": "ERROR", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/opentelemetry/util/_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n File \"/usr/local/lib/python3.10/site-packages/livekit/agents/ipc/job_proc_lazy_main.py\", line 286, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"/opt/deployment/voice-agents-backend/main.py\", line 356, in entrypointx\n await agentToRun.entrypoint(ctx)\n File \"/opt/deployment/voice-agents-backend/screening_assistant.py\", line 2483, in entrypoint\n await session.start(\n File \"/usr/local/lib/python3.10/site-packages/livekit/agents/voice/agent_session.py\", line 595, in start\n raise RuntimeError(\nRuntimeError: Only one `AgentSession` can be the primary at a time. If you want to ignore primary designation, use session.start(record=False).", "pid": 822938, "job_id": "AJ_TPydKPrtXUgz", "room_id": "RM_n8viB9P2pQnW", "timestamp": "2026-04-06T15:27:24.501752+00:00"}
when i try to run two sessions one after the other, and i completely close the previous session and only then start new session, another thing is first session is record=False and only second session is record=True so from what i have read, since the first session is non primary and its closed completely before second session has started its giving this erroreven though im
-
giving record - False to first session, and record = True for second session
-
and closing the first session completely using drain and aclose before starting next session,
when trying to start next session i am getting this error, it doesn’t always happen btw, it happens inconsistently not everytime but alot of times.