{"record":{"id":"a26be35aeb14f90d","repo":"AlexxIT/go2rtc","slug":"webrtcconfigresponse-msg","errorCode":null,"errorMessage":"${webRTCConfigResponse.Msg}","messagePattern":"\\$\\{webRTCConfigResponse\\.Msg\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tuya/smart_api.go","lineNumber":497,"sourceCode":"\n\tdata := SmartApiWebRTCConfigRequest{\n\t\tDevId:         c.deviceId,\n\t\tClientTraceId: fmt.Sprintf(\"%x\", rand.Int63()),\n\t}\n\n\tbody, err := c.request(\"POST\", url, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar webRTCConfigResponse SmartApiWebRTCConfigResponse\n\terr = json.Unmarshal(body, &webRTCConfigResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !webRTCConfigResponse.Success {\n\t\treturn nil, errors.New(webRTCConfigResponse.Msg)\n\t}\n\n\terr = json.Unmarshal([]byte(webRTCConfigResponse.Result.Skill), &c.skill)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Store LocalKey\n\tc.localKey = webRTCConfigResponse.Result.LocalKey\n\n\ticeServers, err := json.Marshal(&webRTCConfigResponse.Result.P2PConfig.Ices)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.iceServers, err = webrtc.UnmarshalICEServers(iceServers)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tuya/smart_api.go#L479-L515","documentation":"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.","triggerScenarios":"Calling TuyaSmartApiClient.GetWebRTCConfig() for a device when the API returns Success=false — device offline/unbound, no WebRTC support, or expired session.","commonSituations":"Camera model without WebRTC skill; device unbound from account; token expired; wrong region for the device; firmware not supporting WebRTC.","solutions":["Read Msg: 'device not found'/'not support' means fix device selection; auth messages mean re-login.","Verify the device ID and that it belongs to the account/region.","Re-authenticate then retry the config call.","Confirm the camera model supports WebRTC in Tuya's docs.","Fall back to an alternate streaming path if the device lacks WebRTC."],"exampleFix":"// before\ncfg, err := client.GetWebRTCConfig(deviceID)\nif err != nil {\n    return err\n}\n// after\ncfg, err := client.GetWebRTCConfig(deviceID)\nif err != nil {\n    return fmt.Errorf(\"webrtc config for device %s: %w\", deviceID, err)\n}","handlingStrategy":"fallback","validationCode":"confirm deviceID is bound to the account and listed by GetHomeList/GetRoomList before requesting WebRTC config","typeGuard":null,"tryCatchPattern":"cfg, err := client.GetWebRTCConfig(deviceID)\nif err != nil {\n    log.Warnf(\"webrtc config failed for %s: %v; falling back\", deviceID, err)\n    cfg = nil // use alternate streaming path\n}","preventionTips":["Check device WebRTC support/model before streaming","Keep session fresh; re-login on auth messages","Validate device ownership and region","Provide a non-WebRTC fallback stream path"],"tags":["api","tuya","webrtc"],"backgroundTag":"api-error-response","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}