`Encountered an unexpected error, check the consol...
# ask-ai
h
Encountered an unexpected error, check the console logs for details: could not establish pc connection
I get this while joining a room and it creates an alert on my application that I don’t have control over either.
t
Thanks for reaching out, Akshat. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The error
could not establish pc connection
occurs when the WebRTC PeerConnection fails to establish during the room connection process. This is typically due to connectivity issues or configuration problems. Here are some steps to address this: • Check Network Configuration: Ensure that WebRTC traffic is not being blocked by firewalls or corporate network restrictions. UDP traffic should be allowed. • Verify TURN/STUN Servers: Confirm that the ICE servers (STUN/TURN) configured for your application are accessible and functioning correctly. • Increase Timeout: You can adjust the
peerConnectionTimeout
in your connection options to allow more time for the connection to establish. • Monitor ICE Connection State: The error message may include the ICE connection state, which can help identify the specific failure point. • Check Browser Console: Look for additional WebRTC-related errors in the browser console logs for more details. This issue is generally related to WebRTC connectivity rather than a specific LiveKit problem, so focusing on network and WebRTC compatibility will be key to resolving it. Sources: src/room/Room.ts
h
Copy code
ERROR   livekit.pion.turn       v4@v4.0.0/server.go:164 Failed to close conn: tls: failed to send closeNotify alert (but connection was closed anyway): write tcp4 10.0.1.10:443->10.0.1.11:31152: write: broken pipe
2025-07-30 15:12:47.711Z <http://github.com/pion/turn/v4.(*Server).readListener.func1|github.com/pion/turn/v4.(*Server).readListener.func1>
2025-07-30 15:12:47.711Z        /go/pkg/mod/github.com/pion/turn/v4@v4.0.0/server.go:164
2025-07-30 15:12:52.884Z 2025-07-30T15:12:52.884Z       INFO    livekit rtc/participant.go:1033 participant closing     {"room": "stgprep_71b10e8d-81a7-4c68-b889-20123d0f86e2", "roomID": "RM_LrzYvYQU2qCg", "participant": "Utkarsh Srivastava", "pID": "PA_NJhGRkhtGSzA", "remote": false, "sendLeave": true, "reason": "PEER_CONNECTION_DISCONNECTED", "isExpectedToResume": false}
2025-07-30 15:13:30.017Z 2025-07-30T15:13:30.017Z       ERROR   livekit.pion.turn       v4@v4.0.0/server.go:164 Failed to close conn: tls: failed to send closeNotify alert (but connection was closed anyway): write tcp4 10.0.1.10:443->10.244.1.214:49814: write: broken pipe
2025-07-30 15:13:30.018Z <http://github.com/pion/turn/v4.(*Server).readListener.func1|github.com/pion/turn/v4.(*Server).readListener.func1>
2025-07-30 15:13:30.018Z        /go/pkg/mod/github.com/pion/turn/v4@v4.0.0/server.go:164
2025-07-30 15:13:30.018Z 2025-07-30T15:13:30.018Z       ERROR   livekit.pion.turn       v4@v4.0.0/server.go:164 Failed to close conn: tls: failed to send closeNotify alert (but connection was closed anyway): write tcp4 10.0.1.10:443->10.244.1.214:49822: write: broken pipe
2025-07-30 15:13:30.018Z <http://github.com/pion/turn/v4.(*Server).readListener.func1|github.com/pion/turn/v4.(*Server).readListener.func1>
2025-07-30 15:13:30.018Z        /go/pkg/mod/github.com/pion/turn/v4@v4.0.0/server.go:164
2025-07-30 15:13:54.086Z 2025-07-30T15:13:54.085Z       INFO    livekit.sub    rtc/subscriptionmanager.go:386   unsubscribing from track after notFoundTimeout {"room": "stgprep_71b10e8d-81a7-4c68-b889-20123d0f86e2", "roomID": "RM_LrzYvYQU2qCg", "participant": "EG_LvJT2YuSpcRr", "pID": "PA_gEvkhmcj3syo", "remote": false, "trackID": "TR_AMetBTPTJcKBHT", "error": "track cannot be found"}
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
h
the above is the error log