AlexxIT/go2rtc · error

${sharedHomeListResponse.Msg}

Error message

${sharedHomeListResponse.Msg}

What it means

GetSharedHomeList returns this error when the Tuya API responds with Success=false; sharedHomeListResponse.Msg is converted directly into an error via errors.New. The HTTP call succeeded but the shared-home-list request was refused by the Tuya cloud. The library surfaces the server's message unchanged.

Solutions

  1. Parse Msg to distinguish 'no shared homes' (treat as empty result) from auth/server failures.
  2. Refresh token/session before retrying.
  3. Confirm the Tuya app has shared-home API permissions enabled in the developer console.
  4. Treat a benign 'no data' Msg as an empty list instead of a hard error in callers.
  5. Log the full response for diagnosis.

Example fix

// before
shared, err := client.GetSharedHomeList()
if err != nil {
    return err
}
// after
shared, err := client.GetSharedHomeList()
if err != nil {
    if strings.Contains(err.Error(), "none") { // benign empty result
        return emptyList, nil
    }
    return fmt.Errorf("tuya GetSharedHomeList: %w", err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if account not configured for sharing, treat empty shared-home list as valid before calling GetSharedHomeList()

Try / catch

shared, err := client.GetSharedHomeList()
if err != nil {
    if strings.Contains(strings.ToLower(err.Error()), "none") {
        return emptyShared, nil // benign
    }
    return fmt.Errorf("tuya shared homes: %w", err)
}

Prevention

When it happens

Trigger: Calling TuyaSmartApiClient.GetSharedHomeList() when the Tuya response body has Success=false.

Common situations: Account has no shared homes (Msg reports empty/none) — arguably not fatal; token expired; wrong region; API permission not enabled for the app.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/1a7d7fc7dc40b5ce. Report an issue: GitHub.

Appendix: source

Thrown at pkg/tuya/smart_api.go:382

	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
	}

	if !sharedHomeListResponse.Success {
		return nil, errors.New(sharedHomeListResponse.Msg)
	}

	return &sharedHomeListResponse, nil
}

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

View on GitHub (pinned to c245815e75)