AlexxIT/go2rtc · error

webrtc:

Error message

webrtc: 

What it means

Same pattern as client.go but in the Kinesis-based WebRTC client: the peer connection state became something other than Connecting/Connected (e.g. failed or closed), returned as "webrtc: <state>" via connState.Done.

Solutions

  1. Inspect the appended state message to see the exact pion state
  2. Verify STUN/TURN configuration works for both peers
  3. Re-check the Kinesis signaling channel and its credentials/expiry
  4. Retry the connection; transient ICE failures often resolve with reachable TURN
Defensive patterns

Strategy: retry

Try / catch

prod, err := kinesisClient(...)
if err != nil && strings.HasPrefix(err.Error(), "webrtc: ") {
	// re-request the signaling session and retry, with backoff
}

Prevention

When it happens

Trigger: Kinesis WebRTC signaling succeeded but ICE/DTLS subsequently failed — unreachable ICE servers, master/viewer session expired, signaling channel revoked, or network interruption during setup.

Common situations: AWS KVS signalled sessions timing out (viewer session TTL); NAT/firewall blocking the media path; wrong ICE server config for the Kinesis stream.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/c0469687ddcbb729. Report an issue: GitHub.

Appendix: source

Thrown at internal/webrtc/kinesis.go:109

		case *pion.ICECandidate:
			_ = sendOffer.Wait()

			req.Action = "ICE_CANDIDATE"
			req.Payload, _ = json.Marshal(msg.ToJSON())
			if err = conn.WriteJSON(&req); err != nil {
				connState.Done(err)
				return
			}

			log.Trace().Msgf("[webrtc] kinesis send: %s", req)

		case pion.PeerConnectionState:
			switch msg {
			case pion.PeerConnectionStateConnecting:
			case pion.PeerConnectionStateConnected:
				connState.Done(nil)
			default:
				connState.Done(errors.New("webrtc: " + msg.String()))
			}
		}
	})

	var payload any

	if sdpOffer == nil {
		medias := []*core.Media{
			{Kind: core.KindVideo, Direction: core.DirectionRecvonly},
			{Kind: core.KindAudio, Direction: core.DirectionRecvonly},
		}

		// 4. Create offer
		var offer string
		if offer, err = prod.CreateOffer(medias); err != nil {
			return nil, err
		}

View on GitHub (pinned to c245815e75)