{"record":{"id":"50d820897f1fbc23","repo":"AlexxIT/go2rtc","slug":"tuya-wrong-query-params","errorCode":null,"errorMessage":"tuya: wrong query params","messagePattern":"tuya: wrong query params","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tuya/client.go","lineNumber":82,"sourceCode":"\tuid := query.Get(\"uid\")\n\tclientId := query.Get(\"client_id\")\n\tclientSecret := query.Get(\"client_secret\")\n\n\t// Shared params\n\tdeviceId := query.Get(\"device_id\")\n\n\t// Stream params\n\tstreamResolution := query.Get(\"resolution\")\n\n\tuseSmartApi := deviceId != \"\" && email != \"\" && password != \"\"\n\tuseCloudApi := deviceId != \"\" && uid != \"\" && clientId != \"\" && clientSecret != \"\"\n\n\tif streamResolution == \"\" || (streamResolution != \"hd\" && streamResolution != \"sd\") {\n\t\tstreamResolution = \"hd\"\n\t}\n\n\tif !useSmartApi && !useCloudApi {\n\t\treturn nil, errors.New(\"tuya: wrong query params\")\n\t}\n\n\tclient := &Client{\n\t\thandlers: make(map[uint32]func(*rtp.Packet)),\n\t}\n\n\tif useSmartApi {\n\t\tif client.api, err = NewTuyaSmartApiClient(nil, u.Hostname(), email, password, deviceId); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"tuya: %w\", err)\n\t\t}\n\t} else {\n\t\tif client.api, err = NewTuyaCloudApiClient(u.Hostname(), uid, deviceId, clientId, clientSecret); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"tuya: %w\", err)\n\t\t}\n\t}\n\n\tif err := client.api.Init(); err != nil {\n\t\treturn nil, fmt.Errorf(\"tuya: %w\", err)","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tuya/client.go#L64-L100","documentation":"Tuya Dial parameter guard: the query string provides neither a complete Smart-API credential set (device_id + email + password) nor a complete Cloud-API set (device_id + uid + client_id + client_secret). At least one full set is required to authenticate, so the source URL's credentials are incomplete.","triggerScenarios":"Thrown at pkg/tuya/client.go:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the missing Smart API params (email, password, device_id) or Cloud params (uid, client_id, client_secret)","Check query param names for typos","Ensure the device_id param is present — it is required by both modes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}