AlexxIT/go2rtc · error
${mqttConfigResponse.Msg}
Error message
${mqttConfigResponse.Msg} What it means
GetMQTTConfig returns this error when the Tuya MQTT-config API responds with Success=false; mqttConfigResponse.Msg is passed directly to errors.New. Without this config the client cannot connect to Tuya's MQTT broker, so live event streaming fails. The server's message is propagated unchanged.
Solutions
- Read Msg to identify auth vs. server failure; re-login if authentication-related.
- Ensure PasswordLogin succeeded and is recent before requesting MQTT config.
- Verify region/endpoint configuration.
- Retry with backoff for transient errors.
- Log the raw response body on failure for Tuya support tickets.
Example fix
// before
cfg, err := client.GetMQTTConfig()
if err != nil {
return err
}
// after
cfg, err := client.GetMQTTConfig()
if err != nil {
return fmt.Errorf("mqtt config: %w", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
if time.Now().Unix() >= client.expireTime { re-login before GetMQTTConfig() } Try / catch
cfg, err := client.GetMQTTConfig()
if err != nil {
if err := client.relogin(); err != nil { return err }
cfg, err = client.GetMQTTConfig()
if err != nil { return fmt.Errorf("mqtt config after relogin: %w", err) }
} Prevention
- Track expireTime and re-login before it lapses (2-day window)
- Only call after successful PasswordLogin
- Verify region endpoint
- Backoff-retry transient cloud errors
When it happens
Trigger: Calling GetMQTTConfig when the mqtt-config endpoint returns Success=false — expired login/session, invalid Msid request, or cloud rejection.
Common situations: Session expired more than 2 days after login (expireTime lapsed); wrong region endpoint; Tuya cloud outage; calling before successful PasswordLogin.
Related errors
- tuya:
- ${appInfoResponse.Msg}
- ${homeListResponse.Msg}
- ${sharedHomeListResponse.Msg}
- ${roomListResponse.Msg}
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/eca67e228f14467b.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/tuya/smart_api.go:549
}, nil
}
func (c *TuyaSmartApiClient) loadHubConfig() (config *MQTTConfig, err error) {
mqttUrl := fmt.Sprintf("https://%s/api/jarvis/mqtt", c.baseUrl)
mqttBody, err := c.request("POST", mqttUrl, nil)
if err != nil {
return nil, err
}
var mqttConfigResponse MQTTConfigResponse
err = json.Unmarshal(mqttBody, &mqttConfigResponse)
if err != nil {
return nil, err
}
if !mqttConfigResponse.Success {
return nil, errors.New(mqttConfigResponse.Msg)
}
return &MQTTConfig{
Url: c.mqttsUrl,
ClientID: fmt.Sprintf("web_%s", mqttConfigResponse.Result.Msid),
Username: fmt.Sprintf("web_%s", mqttConfigResponse.Result.Msid),
Password: mqttConfigResponse.Result.Password,
PublishTopic: "/av/moto/moto_id/u/{device_id}",
SubscribeTopic: fmt.Sprintf("/av/u/%s", mqttConfigResponse.Result.Msid),
}, nil
}
func (c *TuyaSmartApiClient) request(method string, url string, body any) ([]byte, error) {
var bodyReader io.Reader
if body != nil {
jsonBody, err := json.Marshal(body)
if err != nil {
return nil, errView on GitHub (pinned to c245815e75)