salmon-lighter-12882
03/29/2026, 1:43 PMtall-airline-16756
03/29/2026, 1:43 PMtall-airline-16756
03/29/2026, 1:44 PMRTCPeerConnection because one or more ICE server URIs have an invalid hostname or format.
• The ICE servers can come from your LiveKit server (returned with token/grants) or from client-side RTC config (e.g., connectOpts.rtcConfig) if you set that manually.
Steps to diagnose and fix
1. Inspect the ICE server URLs your client receives
◦ In the browser console, log the RTC configuration/ICE servers right before you call connect or construct RTCPeerConnection. Look for entries like stun:... or turn:....
◦ Confirm each URL uses a proper scheme and hostname, for example:
▪︎ stun:stun.l.google.com:19302
▪︎ turn:turn.example.com:443?transport=tcp
◦ Invalid examples that cause this error: missing scheme (turn.example.com), malformed port (turn:host:badport), or spaces/illegal characters.
1. If self-hosted LiveKit is providing ICE servers, check server config
◦ Verify your livekit.yaml (or wherever you configure TURN/STUN) contains valid, fully qualified hostnames or IPs with correct URL format.
◦ Ensure environment variables like LIVEKIT_URL are set to a valid URL (e.g., wss://your-livekit.example.com) and not a malformed string.
1. If you’re manually passing rtcConfig from the client
◦ Validate the iceServers array you pass: each entry should have a urls field with correctly formatted URIs (string or array of strings).
◦ Example shape:
{
iceServers: [
{ urls: ["stun:stun.l.google.com:19302"] },
{ urls: ["turn:turn.example.com:443?transport=tcp"], username: "user", credential: "pass" }
]
}
1. Common mistakes to look for
◦ Using an IP without scheme (should be stun:1.2.3.4:3478).
◦ Including credentials incorrectly (should be separate `username`/`credential` fields or turn:host?transport=...).
◦ Trailing slashes, spaces, or other illegal characters in hostnames.
◦ Returning non-URL strings in the ICE server list (e.g., plain hostnames).
1. Network / DNS checks
◦ Confirm the hostname resolves from the client environment (DNS lookup or ping).
◦ Ensure firewalls allow the relevant ports (TURN/STUN typically 3478/5349 or the ports your TURN server uses).
If you want, please share (redact credentials) one of the ICE server entries you see in the browser console or a snippet of how you configure iceServers / livekit.yaml. With that I can point out the exact formatting issue and suggest the minimal change to fix it.
Sources: Firewall Tips for LiveKit Connectivity | LiveKit | server-sdk-js | livekit/livekit_composite | DeepWiki | Self-hosted deployments | LiveKit Documentation | Diagnosing Connection Errors with the Connection Test Utility | LiveKit | Configure ZScaler proxy for LiveKit connections | LiveKit, with interactive elements