AlexxIT/go2rtc · error

loginResp.ErrorMsg

Error message

loginResp.ErrorMsg

What it means

The Tuya cloud login (PasswordLoginResponse) returned Success=false; go2rtc surfaces the vendor's ErrorMsg string verbatim as the error. The message content comes from the Tuya OpenAPI, not go2rtc itself.

Solutions

  1. Verify Tuya username and password are correct by logging into the Smart Life / Tuya app
  2. Check the configured server host/region matches the account's data center (e.g. openapi.tuyaXX.com)
  3. Update stored credentials after any password change
  4. Inspect the ErrorMsg text for account-state issues (locked, verification required) and resolve in the Tuya app
Defensive patterns

Strategy: try-catch

Try / catch

login, err := tuya.Login(client, cfg)
if err != nil {
	log.Printf("tuya login failed: %v", err) // body is vendor ErrorMsg
	// check credentials/region before retrying
}

Prevention

When it happens

Trigger: Calling tuya login (via the apiTuya endpoint) with wrong username/password, an account locked or needing verification, or against a server/region endpoint that rejects the credentials.

Common situations: Tuya smart-home credentials changed or revoked; using the wrong data-center endpoint for the account; account requires 2FA/captcha; expired app account.

Related errors


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

Appendix: source

Thrown at internal/tuya/tuya.go:161

		Options:     `{"group":1}`,
	}

	if tuya.IsEmailAddress(email) {
		url = fmt.Sprintf("https://%s/api/private/email/login", serverHost)
		loginReq.Email = email
	} else {
		url = fmt.Sprintf("https://%s/api/private/phone/login", serverHost)
		loginReq.Mobile = email
	}

	loginResp, err = performLogin(client, url, loginReq, serverHost)

	if err != nil {
		return nil, err
	}

	if !loginResp.Success {
		return nil, errors.New(loginResp.ErrorMsg)
	}

	return &loginResp.Result, nil
}

func getLoginToken(client *http.Client, serverHost, username, countryCode string) (*tuya.LoginTokenResponse, error) {
	url := fmt.Sprintf("https://%s/api/login/token", serverHost)

	tokenReq := tuya.LoginTokenRequest{
		CountryCode: countryCode,
		Username:    username,
		IsUid:       false,
	}

	jsonData, err := json.Marshal(tokenReq)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to c245815e75)