{"record":{"id":"5f6b4de355a77186","repo":"AlexxIT/go2rtc","slug":"xiaomi-unsupported-model-s","errorCode":null,"errorMessage":"xiaomi: unsupported model: %s","messagePattern":"xiaomi: unsupported model: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/xiaomi/legacy/client.go","lineNumber":42,"sourceCode":"\n\tif query.Has(\"sign\") {\n\t\t// Legacy with encryption\n\t\tkey, err = crypto.CalcSharedKey(query.Get(\"device_public\"), query.Get(\"client_private\"))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tusername = fmt.Sprintf(\n\t\t\t`{\"public_key\":\"%s\",\"sign\":\"%s\",\"account\":\"admin\"}`,\n\t\t\tquery.Get(\"client_public\"), query.Get(\"sign\"),\n\t\t)\n\t} else if model == ModelMijia || model == ModelXiaobai {\n\t\tusername = \"admin\"\n\t\tpassword = query.Get(\"password\")\n\t} else if model == ModelDafang || model == ModelXiaofang {\n\t\tusername = \"admin\"\n\t} else {\n\t\treturn nil, fmt.Errorf(\"xiaomi: unsupported model: %s\", model)\n\t}\n\n\tconn, err := tutk.Dial(u.Host, query.Get(\"uid\"), username, password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif model == ModelDafang || model == ModelXiaofang {\n\t\terr = xiaofangLogin(conn, query.Get(\"password\"))\n\t\tif err != nil {\n\t\t\t_ = conn.Close()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc := &Client{\n\t\tConn:  conn,\n\t\tkey:   key,","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/xiaomi/legacy/client.go#L24-L60","documentation":"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.","triggerScenarios":"Calling Dial with a URL whose model query/path component is not one of the supported model constants, e.g. model=unknown-cam.","commonSituations":"Typo in the model parameter; buying a newer camera model not yet supported by this library; copying a URL from a different vendor.","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"],"exampleFix":"// before\nurl := \"xiaomi://host?model=dafangHD&...\"\n// after\nurl := \"xiaomi://host?model=dafang&...\" // exact supported model constant","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"mijia\":true,\"xiaobai\":true,\"dafang\":true,\"xiaofang\":true}\nif !supported[strings.ToLower(model)] {\n    return fmt.Errorf(\"model %q not supported by legacy client\", model)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["xiaomi","unsupported-model","configuration"],"backgroundTag":"invalid-enum-value","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"}