{"record":{"id":"1a7d7fc7dc40b5ce","repo":"AlexxIT/go2rtc","slug":"sharedhomelistresponse-msg","errorCode":null,"errorMessage":"${sharedHomeListResponse.Msg}","messagePattern":"\\$\\{sharedHomeListResponse\\.Msg\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tuya/smart_api.go","lineNumber":382,"sourceCode":"\n\treturn &homeListResponse, nil\n}\n\nfunc (c *TuyaSmartApiClient) GetSharedHomeList() (*SharedHomeListResponse, error) {\n\turl := fmt.Sprintf(\"https://%s/api/new/playback/shareList\", c.baseUrl)\n\n\tbody, err := c.request(\"POST\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar sharedHomeListResponse SharedHomeListResponse\n\tif err := json.Unmarshal(body, &sharedHomeListResponse); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !sharedHomeListResponse.Success {\n\t\treturn nil, errors.New(sharedHomeListResponse.Msg)\n\t}\n\n\treturn &sharedHomeListResponse, nil\n}\n\nfunc (c *TuyaSmartApiClient) GetRoomList(homeId string) (*RoomListResponse, error) {\n\turl := fmt.Sprintf(\"https://%s/api/new/common/roomList\", c.baseUrl)\n\n\tdata := RoomListRequest{\n\t\tHomeId: homeId,\n\t}\n\n\tbody, err := c.request(\"POST\", url, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar roomListResponse RoomListResponse","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tuya/smart_api.go#L364-L400","documentation":"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.","triggerScenarios":"Calling TuyaSmartApiClient.GetSharedHomeList() when the Tuya response body has Success=false.","commonSituations":"Account has no shared homes (Msg reports empty/none) — arguably not fatal; token expired; wrong region; API permission not enabled for the app.","solutions":["Parse Msg to distinguish 'no shared homes' (treat as empty result) from auth/server failures.","Refresh token/session before retrying.","Confirm the Tuya app has shared-home API permissions enabled in the developer console.","Treat a benign 'no data' Msg as an empty list instead of a hard error in callers.","Log the full response for diagnosis."],"exampleFix":"// before\nshared, err := client.GetSharedHomeList()\nif err != nil {\n    return err\n}\n// after\nshared, err := client.GetSharedHomeList()\nif err != nil {\n    if strings.Contains(err.Error(), \"none\") { // benign empty result\n        return emptyList, nil\n    }\n    return fmt.Errorf(\"tuya GetSharedHomeList: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"if account not configured for sharing, treat empty shared-home list as valid before calling GetSharedHomeList()","typeGuard":null,"tryCatchPattern":"shared, err := client.GetSharedHomeList()\nif err != nil {\n    if strings.Contains(strings.ToLower(err.Error()), \"none\") {\n        return emptyShared, nil // benign\n    }\n    return fmt.Errorf(\"tuya shared homes: %w\", err)\n}","preventionTips":["Enable shared-home API permissions in Tuya developer console","Treat 'no data' messages as empty results","Re-authenticate on auth-related messages","Log raw responses"],"tags":["api","tuya","http-error-response"],"backgroundTag":"api-error-response","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"}