Room state inconsistency: “Room does not exist” errors while participants are still connected

Recently, we have experienced a couple of issues with room state inconsistency. As a result, we were unable to start recordings or update room metadata, because the server responded that the room does not exist.

We encountered a similar issue in the past, when we were manually deleting the room upon receiving the last participant_left event. However, the room lifecycle is now managed entirely by LiveKit Cloud, and we no longer delete rooms ourselves.

It has recently been suggested that we use unique room names, but this is not feasible for our use cases.

How can we mitigate or eliminate this issue?

Room ID: RM_KueBy3HbcbuE

According to the webhook events, the room was finished at approximately 17:15 UTC. However, participants remained connected to the room and did not leave until approximately 18:15 UTC.

Below are the relevant logs from our system:

Below are logs from our system:
89132c5e-1c43-4702-a587-61e1a19ef948 766100-5ed26c36a7b54901a2fa5af74c5654e6 RM_KueBy3HbcbuE participant_joined 2026-10-26 17:15:16.092296 655332 “{”“isModerator”“:false,”“participantStatus”“:”“waiting”“,”“language”“:”“pl”“}”
c154fed9-2712-4866-ac9c-509aadf40cd7 766100-5ed26c36a7b54901a2fa5af74c5654e6 RM_KueBy3HbcbuE room_finished 2026-10-26 17:15:22.980223 null null
c63c8dc4-35dd-49b6-b449-bdbafa8f27f7 766100-5ed26c36a7b54901a2fa5af74c5654e6 RM_KueBy3HbcbuE participant_left 2026-10-26 17:15:27.78957 655332 “{”“isModerator”“:false,”“participantStatus”“:”“waiting”“,”“language”“:”“pl”“}”
3aff37fe-5fb3-46d5-9579-382c168f86dd 766100-5ed26c36a7b54901a2fa5af74c5654e6 RM_KueBy3HbcbuE participant_joined 2026-10-26 17:15:50.922957 655332 “{”“isModerator”“:false,”“participantStatus”“:”“waiting”“,”“language”“:”“pl”“}”

I’m just looking at the events at https://cloud.livekit.io/projects/p_/sessions/RM_KueBy3HbcbuE/events. The other issue you have is the agent leaves the room when whomever they were speaking with leaves, so the next participant to join the room does not have an agent dispatched. I don’t understand exactly why the room ended when it did, with participants still connected.

If LiveKit Cloud is managing your room lifecycle, you are going to hit this kind of issue if you do not use unique room names. Since unique room names is not feasible, I think the best option would be to manage the room lifecycle yourself.

You could still let LiveKit delete your rooms once everyone leaves, and you are responsible for creating new rooms manually (though you wouldn’t be able to reliably use the same name)

@Marek_Adamkiewicz,Room does not exist is the lifecycle close, not a separate fault. A room is kept only for departure_timeout after the last participant leaves, then it closes and its state is deleted, which fires room_finished. The default is 20 seconds (config.go#L636-L637), so any reconnect or waiting gap longer than that closes the room while users are still arriving. After the close, StartEgress and UpdateRoomMetadata return not-found until the next join recreates the room, and the new room keeps the name but starts with empty metadata.

Your events match: join 17:15:16, room_finished 17:15:22, left 17:15:27, rejoin 17:15:50. The close fired in the gap, and the rejoin built a fresh, blank room.

The close-while-connected part is reported in livekit#4316: a node ends the room when its local participant count reaches zero and deletes shared state while other participants stay connected. The maintainer notes OSS rooms live on one node, so that cross-node case is specific to multi-node OSS. Your Cloud trigger is in the session logs, which is the part already in review.

Manage the room yourself to keep one stable name and remove the race. Raise departureTimeout so the window covers your gaps, set metadata at creation because a recreated room starts empty, and call createRoom before egress or metadata because a room also auto-creates on first join and you want to act on the instance you configured. The documented createRoom pattern (managing-rooms) takes emptyTimeout and maxParticipants; departureTimeout and metadata are on the same CreateOptions (RoomServiceClient.ts#L43-L59):

import { RoomServiceClient } from 'livekit-server-sdk';
const svc = new RoomServiceClient(url, apiKey, apiSecret);
await svc.createRoom({
  name: roomName,
  departureTimeout: 300,           // default 20s; cover reconnect/waiting gaps
  emptyTimeout: 600,
  metadata: JSON.stringify(state), // set here; UpdateRoomMetadata needs the room to exist
});