boundless-painting-47811
09/10/2025, 11:41 PMapp.services.externals.lkapi:delete_room:29 - TwirpError deleting room call_b31967d3305a4a11a042ef917d90cb9c: TwirpError(code=unknown, message=unknown_error room_reliable_messenger: cannot reset while context state is RUNNING, status=500)
when calling deleting room after participant disconnected, I am deleting the room, and this is the error I am encounteringtall-airline-16756
09/10/2025, 11:41 PMtall-airline-16756
09/10/2025, 11:42 PMRUNNING
, which stops it from being deleted. This usually means there are still active operations, like agent sessions or media processing, going on.
Here’s how we can work through this together:
1. First, make sure all participants have disconnected by using ListParticipants
to check that the room is empty.
2. Next, gracefully close the agent session with session.aclose()
and wait for any ongoing speech to finish by using current_speech.wait_for_playout()
.
3. It’s helpful to add cleanup logic in a session on_exit
handler to flush any pending messages and close the session before you try deleting the room.
4. Finally, call DeleteRoom
only after you’re sure there are no active operations left.
If you’re still running into issues, turning on debug logging can help spot any long-running tasks or SIP sessions that might be hanging around. Please don’t hesitate to reach out if you’d like me to guide you through these steps or if you need any further help—I’m here for you!
Sources: pkg/service/roomservice_test.go | telephony/sip_lifecycle.py | agent.py | Inside a session | LiveKit Docs | livekit/livekit_room.twirp.go