AlexxIT/go2rtc · error

${webRTCConfigResponse.Msg}

Error message

${webRTCConfigResponse.Msg}

What it means

GetWebRTCConfig returns this error when the Tuya WebRTC-config API responds with Success=false; webRTCConfigResponse.Msg is wrapped via errors.New. Without a valid config, the WebRTC skill cannot be parsed and camera streaming cannot start. The server's message is surfaced verbatim.

Solutions

  1. Read Msg: 'device not found'/'not support' means fix device selection; auth messages mean re-login.
  2. Verify the device ID and that it belongs to the account/region.
  3. Re-authenticate then retry the config call.
  4. Confirm the camera model supports WebRTC in Tuya's docs.
  5. Fall back to an alternate streaming path if the device lacks WebRTC.

Example fix

// before
cfg, err := client.GetWebRTCConfig(deviceID)
if err != nil {
    return err
}
// after
cfg, err := client.GetWebRTCConfig(deviceID)
if err != nil {
    return fmt.Errorf("webrtc config for device %s: %w", deviceID, err)
}
Defensive patterns

Strategy: fallback

Validate before calling

confirm deviceID is bound to the account and listed by GetHomeList/GetRoomList before requesting WebRTC config

Try / catch

cfg, err := client.GetWebRTCConfig(deviceID)
if err != nil {
    log.Warnf("webrtc config failed for %s: %v; falling back", deviceID, err)
    cfg = nil // use alternate streaming path
}

Prevention

When it happens

Trigger: Calling TuyaSmartApiClient.GetWebRTCConfig() for a device when the API returns Success=false — device offline/unbound, no WebRTC support, or expired session.

Common situations: Camera model without WebRTC skill; device unbound from account; token expired; wrong region for the device; firmware not supporting WebRTC.

Related errors


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

Appendix: source

Thrown at pkg/tuya/smart_api.go:497

	data := SmartApiWebRTCConfigRequest{
		DevId:         c.deviceId,
		ClientTraceId: fmt.Sprintf("%x", rand.Int63()),
	}

	body, err := c.request("POST", url, data)
	if err != nil {
		return nil, err
	}

	var webRTCConfigResponse SmartApiWebRTCConfigResponse
	err = json.Unmarshal(body, &webRTCConfigResponse)
	if err != nil {
		return nil, err
	}

	if !webRTCConfigResponse.Success {
		return nil, errors.New(webRTCConfigResponse.Msg)
	}

	err = json.Unmarshal([]byte(webRTCConfigResponse.Result.Skill), &c.skill)
	if err != nil {
		return nil, err
	}

	// Store LocalKey
	c.localKey = webRTCConfigResponse.Result.LocalKey

	iceServers, err := json.Marshal(&webRTCConfigResponse.Result.P2PConfig.Ices)
	if err != nil {
		return nil, err
	}

	c.iceServers, err = webrtc.UnmarshalICEServers(iceServers)
	if err != nil {
		return nil, err

View on GitHub (pinned to c245815e75)