{"record":{"id":"d5668958813c5977","repo":"AlexxIT/go2rtc","slug":"tuya-no-mqtt-client","errorCode":null,"errorMessage":"tuya: no mqtt client","messagePattern":"tuya: no mqtt client","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tuya/client.go","lineNumber":139,"sourceCode":"\t\tclient.Close(err)\n\t\treturn nil, err\n\t}\n\n\t// protect from sending ICE candidate before Offer\n\tvar sendOffer core.Waiter\n\n\t// protect from blocking on errors\n\tdefer sendOffer.Done(nil)\n\n\t// Create new WebRTC connection\n\tclient.conn = webrtc.NewConn(client.pc)\n\tclient.conn.FormatName = \"tuya/webrtc\"\n\tclient.conn.Mode = core.ModeActiveProducer\n\tclient.conn.Protocol = \"mqtt\"\n\n\tmqttClient := client.api.GetMqtt()\n\tif mqttClient == nil {\n\t\terr = errors.New(\"tuya: no mqtt client\")\n\t\tclient.Close(err)\n\t\treturn nil, err\n\t}\n\n\t// Set up MQTT handlers\n\tmqttClient.handleAnswer = func(answer AnswerFrame) {\n\t\t// fmt.Printf(\"tuya: answer: %s\\n\", answer.Sdp)\n\n\t\tdesc := pion.SessionDescription{\n\t\t\tType: pion.SDPTypePranswer,\n\t\t\tSDP:  answer.Sdp,\n\t\t}\n\n\t\tif err = client.pc.SetRemoteDescription(desc); err != nil {\n\t\t\tclient.Close(err)\n\t\t\treturn\n\t\t}\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tuya/client.go#L121-L157","documentation":"Tuya Dial guard: after setting up the WebRTC connection, api.GetMqtt() returned nil — the API layer has no live MQTT client (login/connect failed earlier or was never completed). Without MQTT there is no signaling channel, so the client is closed and Dial aborts.","triggerScenarios":"Thrown at pkg/tuya/client.go:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check earlier login/API errors that left MQTT uninitialized","Verify Tuya credentials and internet reachability, then retry Dial","Ensure the API client's Connect/MQTT setup completes before streaming"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}