agents icon indicating copy to clipboard operation
agents copied to clipboard

KeyError in Room._on_room_event for local_track_published (track SID missing from local_participant.track_publications)

Open MonkeyLeeT opened this issue 1 month ago • 2 comments

Bug Description

KeyError logged and bubbles through _listen_task’s error logging

error running user callback for local_track_published: room_handle: 6 local_track_published { track_sid: "TR_AMLxYxTEBo2L7c" } Traceback (most recent call last): File "/home/appuser/.venv/lib/python3.12/site-packages/livekit/rtc/room.py", line 589, in _listen_task self._on_room_event(event.room_event) File "/home/appuser/.venv/lib/python3.12/site-packages/livekit/rtc/room.py", line 636, in _on_room_event lpublication = self.local_participant.track_publications[sid] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ KeyError: 'TR_AMLxYxTEBo2L7c'

Expected Behavior

Event should be ignored or publication map populated; shouldn’t raise

Reproduction Steps

- Start LiveKit Agents voice session; 
- User speaks immediately after join; 
- SDK emits local_track_published before the publication map is populated
- KeyError logged from Room._on_room_event

Operating System

Linux

Models Used

No response

Package Versions

livekit-agent=1.3.6

Session/Room/Call IDs

No response

Proposed Solution


Additional Context

No response

Screenshots and Recordings

No response

MonkeyLeeT avatar Dec 08 '25 19:12 MonkeyLeeT