AlexxIT/go2rtc · error
${homeListResponse.Msg}
Error message
${homeListResponse.Msg} What it means
GetHomeList returns this error when the Tuya Smart API responds with Success=false; homeListResponse.Msg is passed directly to errors.New. The request reached the Tuya cloud, but the home-list query was rejected (auth/token problem, wrong home, or cloud failure). The library propagates the API's own message instead of inventing one.
Solutions
- Read the Msg content to identify the exact Tuya failure (auth vs. not-found vs. server error).
- Refresh the session: re-run initToken/PasswordLogin flow, then retry GetHomeList.
- Validate credentials and region configuration for the client.
- Retry with backoff only for transient messages (timeouts, server busy).
- Capture the raw response in logs for diagnosis.
Example fix
// before
homes, err := client.GetHomeList()
if err != nil {
return err
}
// after
homes, err := client.GetHomeList()
if err != nil {
return fmt.Errorf("tuya GetHomeList: %w", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
ensure session token is fresh (call initToken/login recently) before GetHomeList()
Try / catch
homes, err := client.GetHomeList()
if err != nil {
if isAuthError(err) { relogin(); homes, err = client.GetHomeList() }
if err != nil { return fmt.Errorf("tuya home list: %w", err) }
} Prevention
- Refresh tokens proactively before expiry
- Validate region and credentials at startup
- Distinguish auth vs. transient errors from Msg text
- Log raw responses for diagnosis
When it happens
Trigger: Calling TuyaSmartApiClient.GetHomeList() when the Tuya API response has Success=false and a non-empty Msg field.
Common situations: Access token expired between login and the call; user account has no homes or was revoked; wrong region endpoint; Tuya cloud rate limiting.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/d7cbd52b6697a745.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/tuya/smart_api.go:362
return &appInfoResponse, nil
}
func (c *TuyaSmartApiClient) GetHomeList() (*HomeListResponse, error) {
url := fmt.Sprintf("https://%s/api/new/common/homeList", c.baseUrl)
body, err := c.request("POST", url, nil)
if err != nil {
return nil, err
}
var homeListResponse HomeListResponse
if err := json.Unmarshal(body, &homeListResponse); err != nil {
return nil, err
}
if !homeListResponse.Success {
return nil, errors.New(homeListResponse.Msg)
}
return &homeListResponse, nil
}
func (c *TuyaSmartApiClient) GetSharedHomeList() (*SharedHomeListResponse, error) {
url := fmt.Sprintf("https://%s/api/new/playback/shareList", c.baseUrl)
body, err := c.request("POST", url, nil)
if err != nil {
return nil, err
}
var sharedHomeListResponse SharedHomeListResponse
if err := json.Unmarshal(body, &sharedHomeListResponse); err != nil {
return nil, err
}
View on GitHub (pinned to c245815e75)