AlexxIT/go2rtc · error
xiaomi: unsupported model
Error message
xiaomi: unsupported model: %s
What it means
NewClient for legacy Xiaomi cameras only supports a fixed set of models (Mijia, Xiaobai, Dafang, Xiaofang, and whatever the primary branch handles). Any other model string in the RTSP-style URL is rejected before a connection is dialed.
Solutions
- Check the model string against the supported model constants in pkg/xiaomi/legacy (ModelMijia, ModelXiaobai, ModelDafang, ModelXiaofang, etc.)
- Fix the typo in the model parameter of the connection URL
- Upgrade the library in case support for your model was added upstream
- Use a vendor-supported integration (e.g. miss client) if your camera is a Miss-based model
Example fix
// before url := "xiaomi://host?model=dafangHD&..." // after url := "xiaomi://host?model=dafang&..." // exact supported model constant
Defensive patterns
Strategy: validation
Validate before calling
supported := map[string]bool{"mijia":true,"xiaobai":true,"dafang":true,"xiaofang":true}
if !supported[strings.ToLower(model)] {
return fmt.Errorf("model %q not supported by legacy client", model)
} Prevention
- Keep a whitelist of supported model constants and validate URLs before Dial
- Check upstream releases before adding new camera models
- Fail fast at configuration load time rather than at Dial time
When it happens
Trigger: Calling Dial with a URL whose model query/path component is not one of the supported model constants, e.g. model=unknown-cam.
Common situations: Typo in the model parameter; buying a newer camera model not yet supported by this library; copying a URL from a different vendor.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- miss: unsupported vendor
- credentials: storage not initialized
- hap: can't dial witout client_id or client_private
- multipart: no receivers
- nest: wrong query
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/5f6b4de355a77186.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/xiaomi/legacy/client.go:42
if query.Has("sign") {
// Legacy with encryption
key, err = crypto.CalcSharedKey(query.Get("device_public"), query.Get("client_private"))
if err != nil {
return nil, err
}
username = fmt.Sprintf(
`{"public_key":"%s","sign":"%s","account":"admin"}`,
query.Get("client_public"), query.Get("sign"),
)
} else if model == ModelMijia || model == ModelXiaobai {
username = "admin"
password = query.Get("password")
} else if model == ModelDafang || model == ModelXiaofang {
username = "admin"
} else {
return nil, fmt.Errorf("xiaomi: unsupported model: %s", model)
}
conn, err := tutk.Dial(u.Host, query.Get("uid"), username, password)
if err != nil {
return nil, err
}
if model == ModelDafang || model == ModelXiaofang {
err = xiaofangLogin(conn, query.Get("password"))
if err != nil {
_ = conn.Close()
return nil, err
}
}
c := &Client{
Conn: conn,
key: key,View on GitHub (pinned to c245815e75)