You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
on_webrtc_candidate raises RingError when an ICE candidate arrives before the stream is created (trickle-ICE race) #560
When a Home Assistant frontend opens a Ring live view, ICE candidates are delivered to the library as separate websocket messages (HA camera/webrtcws_candidate → Ring async_on_webrtc_candidate → RingDoorBell.on_webrtc_candidate). If a candidate arrives before the offer has been processed — i.e. the session is not yet in self._webrtc_streams — on_webrtc_candidate hard-raises:
ifstream:=self._webrtc_streams.get(session_id):
awaitstream.on_ice_candidate(candidate, multi_line_index)
else:
msg="Ice candidate received before stream has been created."raiseRingError(msg)
The candidate is discarded, and because HA's ring/camera.py does not catch RingError there, every early candidate produces a full "Unknown error" traceback in the HA log (homeassistant.components.websocket_api.http.connection). Bursts of 4–5+ occur at live-view start.
The same can happen for a candidate that arrives after a session was closed and popped from _webrtc_streams.
Impact
Streams still connect in the observed cases (later candidates succeed once registration lands), so this is primarily log noise plus lost candidates. In pathological timing — all of a client's candidates beating the offer — a connection attempt could fail and need a retry.
Environment
python-ring-doorbell 0.9.14 (latest release; the same raise is present on master)
Home Assistant 2026.10.0 (Ring integration)
Client: Home Assistant iOS app (WebRTC viewer)
Observed repeatedly on 2026-10-16 and 2026-10-17, each time while a Ring camera live view was opened from the iOS app
Traceback (from HA core log)
File "/usr/src/homeassistant/homeassistant/components/camera/webrtc.py", line 347, in ws_candidate
await camera.async_on_webrtc_candidate(msg["session_id"], msg["candidate"])
File "/usr/src/homeassistant/homeassistant/components/ring/camera.py", line 242, in async_on_webrtc_candidate
await self._device.on_webrtc_candidate(...)
ring_doorbell.exceptions.RingError: Ice candidate received before stream has been created.
Suggested fix
Buffer candidates per session_id until the stream registers (flush on creation, drop on close), or downgrade this case to a debug/warning log and drop the candidate instead of raising. Either removes the traceback spam; buffering additionally removes the candidate-loss race introduced with trickle ICE (#460).
Activity