AlexxIT/go2rtc · error

wrong request

Error message

wrong request

What it means

apiAuth's switch found none of the expected field combinations: no username/password pair, no captcha, and no verify code were provided, so no login variant can be attempted. Rejects with 400; a generic input-validation guard.

Solutions

  1. Submit username+password, captcha, or verify — at least one authentication input
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/xiaomi/xiaomi.go:322 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/780655639621248b. Report an issue: GitHub.

Appendix: source

Thrown at internal/xiaomi/xiaomi.go:322

	}

	username := r.Form.Get("username")
	password := r.Form.Get("password")
	captcha := r.Form.Get("captcha")
	verify := r.Form.Get("verify")

	var err error

	switch {
	case username != "" || password != "":
		auth = xiaomi.NewCloud(AppXiaomiHome)
		err = auth.Login(username, password)
	case captcha != "":
		err = auth.LoginWithCaptcha(captcha)
	case verify != "":
		err = auth.LoginWithVerify(verify)
	default:
		http.Error(w, "wrong request", http.StatusBadRequest)
		return
	}

	if err == nil {
		userID, token := auth.UserToken()
		auth = nil

		cloudsMu.Lock()
		if tokens == nil {
			tokens = map[string]string{userID: token}
		} else {
			tokens[userID] = token
		}
		cloudsMu.Unlock()

		err = app.PatchConfig([]string{"xiaomi", userID}, token)
	}

View on GitHub (pinned to c245815e75)