{"record":{"id":"d7cbd52b6697a745","repo":"AlexxIT/go2rtc","slug":"homelistresponse-msg","errorCode":null,"errorMessage":"${homeListResponse.Msg}","messagePattern":"\\$\\{homeListResponse\\.Msg\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tuya/smart_api.go","lineNumber":362,"sourceCode":"\n\treturn &appInfoResponse, nil\n}\n\nfunc (c *TuyaSmartApiClient) GetHomeList() (*HomeListResponse, error) {\n\turl := fmt.Sprintf(\"https://%s/api/new/common/homeList\", 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 homeListResponse HomeListResponse\n\tif err := json.Unmarshal(body, &homeListResponse); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !homeListResponse.Success {\n\t\treturn nil, errors.New(homeListResponse.Msg)\n\t}\n\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","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tuya/smart_api.go#L344-L380","documentation":"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.","triggerScenarios":"Calling TuyaSmartApiClient.GetHomeList() when the Tuya API response has Success=false and a non-empty Msg field.","commonSituations":"Access token expired between login and the call; user account has no homes or was revoked; wrong region endpoint; Tuya cloud rate limiting.","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."],"exampleFix":"// before\nhomes, err := client.GetHomeList()\nif err != nil {\n    return err\n}\n// after\nhomes, err := client.GetHomeList()\nif err != nil {\n    return fmt.Errorf(\"tuya GetHomeList: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"ensure session token is fresh (call initToken/login recently) before GetHomeList()","typeGuard":null,"tryCatchPattern":"homes, err := client.GetHomeList()\nif err != nil {\n    if isAuthError(err) { relogin(); homes, err = client.GetHomeList() }\n    if err != nil { return fmt.Errorf(\"tuya home list: %w\", err) }\n}","preventionTips":["Refresh tokens proactively before expiry","Validate region and credentials at startup","Distinguish auth vs. transient errors from Msg text","Log raw responses for diagnosis"],"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-15T23:17:13.987Z"}