AlexxIT/go2rtc · error

login failed

Error message

login failed: %v

What it means

HTTP 500 returned by the Tuya auth API handler when the email/password login against the selected regional Tuya host fails (invalid credentials, region mismatch, or network error), with the login error embedded in the response text.

Solutions

  1. Verify email/password and region
  2. Retry on transient network failures
  3. Inspect the wrapped cause for the specific auth step that failed
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/tuya/tuya.go:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at internal/tuya/tuya.go:54

	var tuyaRegion *tuya.Region
	for _, r := range tuya.AvailableRegions {
		if r.Host == region {
			tuyaRegion = &r
			break
		}
	}

	if tuyaRegion == nil {
		http.Error(w, fmt.Sprintf("invalid region: %s", region), http.StatusBadRequest)
		return
	}

	httpClient := tuya.CreateHTTPClientWithSession()

	_, err := login(httpClient, tuyaRegion.Host, email, password, tuyaRegion.Continent)
	if err != nil {
		http.Error(w, fmt.Sprintf("login failed: %v", err), http.StatusInternalServerError)
		return
	}

	tuyaAPI, err := tuya.NewTuyaSmartApiClient(
		httpClient,
		tuyaRegion.Host,
		email,
		password,
		"",
	)

	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	var devices []tuya.Device

View on GitHub (pinned to c245815e75)