{"record":{"id":"0fd437c37907c35f","repo":"AlexxIT/go2rtc","slug":"appinforesponse-msg","errorCode":null,"errorMessage":"${appInfoResponse.Msg}","messagePattern":"\\$\\{appInfoResponse\\.Msg\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tuya/smart_api.go","lineNumber":342,"sourceCode":"func (c *TuyaSmartApiClient) GetStreamUrl(streamType string) (streamUrl string, err error) {\n\treturn \"\", errors.New(\"not supported\")\n}\n\nfunc (c *TuyaSmartApiClient) GetAppInfo() (*AppInfoResponse, error) {\n\turl := fmt.Sprintf(\"https://%s/api/customized/web/app/info\", 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 appInfoResponse AppInfoResponse\n\tif err := json.Unmarshal(body, &appInfoResponse); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !appInfoResponse.Success {\n\t\treturn nil, errors.New(appInfoResponse.Msg)\n\t}\n\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","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tuya/smart_api.go#L324-L360","documentation":"GetAppInfo returns this error when the Tuya Smart API responds with Success=false; the server-side message from AppInfoResponse.Msg is surfaced verbatim via errors.New. It means the HTTP request completed but the Tuya cloud rejected or failed the app-info request (bad credentials, bad params, or cloud-side issue). The library throws it to propagate the API's own error text to the caller.","triggerScenarios":"Calling TuyaSmartApiClient.GetAppInfo() when the Tuya API returns a JSON body whose Success field is false, with the human-readable reason in Msg.","commonSituations":"Expired or invalid Tuya credentials/access tokens; wrong region/API endpoint configured; Tuya cloud outage or rate limiting; device/account unlinked so app info is unavailable.","solutions":["Inspect the returned Msg text for the concrete Tuya API reason (e.g. token expired) and fix that root cause first.","Re-initialize the client/token (initToken / login) before retrying GetAppInfo.","Verify the Tuya region/endpoint and credentials (access key, app account) in your configuration.","Add retry with backoff for transient cloud errors, and fail fast on authentication-type messages.","Log the full response body on failure to capture error codes beyond Msg."],"exampleFix":"// before\nresp, err := client.GetAppInfo()\nif err != nil {\n    log.Fatal(err) // bare \"Msg\" text, no context\n}\n// after\nresp, err := client.GetAppInfo()\nif err != nil {\n    log.Fatalf(\"get app info failed: %v\", err) // wrap with context\n}","handlingStrategy":"try-catch","validationCode":"if client == nil || client token expired { reinitialize client before calling GetAppInfo() }","typeGuard":null,"tryCatchPattern":"resp, err := client.GetAppInfo()\nif err != nil {\n    switch {\n    case strings.Contains(err.Error(), \"token\"):\n        // re-authenticate and retry once\n    default:\n        return fmt.Errorf(\"tuya app info: %w\", err)\n    }\n}","preventionTips":["Re-authenticate before long-lived sessions make API calls","Log full API response bodies on failure","Pin correct region/endpoint config","Add backoff retries only for transient server messages"],"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"}