AlexxIT/go2rtc · error
${roomListResponse.Msg}
Error message
${roomListResponse.Msg} What it means
GetRoomList returns this error when the Tuya API responds with Success=false; roomListResponse.Msg is wrapped directly via errors.New. The request reached the cloud but the room listing for the given homeId was rejected. The library forwards the server's own message.
Solutions
- Check Msg for 'not exist'/'permission' wording and validate the homeId against GetHomeList results.
- Re-authenticate (initToken/login) and retry.
- Verify homeId belongs to the logged-in account and region.
- Distinguish permanent errors (bad homeId) from transient ones before retrying.
- Log full response body on failure.
Example fix
// before
rooms, err := client.GetRoomList(homeID)
if err != nil {
return err
}
// after
rooms, err := client.GetRoomList(homeID)
if err != nil {
return fmt.Errorf("get rooms for home %s: %w", homeID, err)
} Defensive patterns
Strategy: validation
Validate before calling
homes, _ := client.GetHomeList()
valid := false
for _, h := range homes.Result {
if h.HomeID == homeID { valid = true }
}
if !valid { return fmt.Errorf("home %s not in account", homeID) }
rooms, err := client.GetRoomList(homeID) Try / catch
rooms, err := client.GetRoomList(homeID)
if err != nil {
return fmt.Errorf("rooms for home %s: %w", homeID, err)
} Prevention
- Validate homeId against GetHomeList before calling
- Re-authenticate when Msg indicates token problems
- Avoid caching homeIds across account changes
- Log full responses on failure
When it happens
Trigger: Calling TuyaSmartApiClient.GetRoomList(homeId) with a homeId whose API response carries Success=false — e.g. nonexistent homeId, revoked access, or expired token.
Common situations: Passing a homeId from a different account/region; home deleted after listing; token expiry mid-session; Tuya cloud error.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/7d955c2607bc17d6.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/tuya/smart_api.go:406
func (c *TuyaSmartApiClient) GetRoomList(homeId string) (*RoomListResponse, error) {
url := fmt.Sprintf("https://%s/api/new/common/roomList", c.baseUrl)
data := RoomListRequest{
HomeId: homeId,
}
body, err := c.request("POST", url, data)
if err != nil {
return nil, err
}
var roomListResponse RoomListResponse
if err := json.Unmarshal(body, &roomListResponse); err != nil {
return nil, err
}
if !roomListResponse.Success {
return nil, errors.New(roomListResponse.Msg)
}
return &roomListResponse, nil
}
func (c *TuyaSmartApiClient) initToken() error {
tokenUrl := fmt.Sprintf("https://%s/api/login/token", c.baseUrl)
tokenReq := LoginTokenRequest{
CountryCode: c.countryCode,
Username: c.email,
IsUid: false,
}
body, err := c.request("POST", tokenUrl, tokenReq)
if err != nil {
return err
}View on GitHub (pinned to c245815e75)