{"record":{"id":"4e5f5ac87c274c66","repo":"AlexxIT/go2rtc","slug":"miss-auth-s","errorCode":null,"errorMessage":"miss: auth: %s","messagePattern":"miss: auth: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/xiaomi/miss/client.go","lineNumber":119,"sourceCode":"\tcmdDevInfoRes        = 0x111\n\tcmdMotorReq          = 0x112\n\tcmdMotorRes          = 0x113\n\tcmdEncoded           = 0x1001\n)\n\nfunc login(conn Conn, clientPublic, sign string) error {\n\ts := fmt.Sprintf(`{\"public_key\":\"%s\",\"sign\":\"%s\",\"uuid\":\"\",\"support_encrypt\":0}`, clientPublic, sign)\n\tif err := conn.WriteCommand(cmdAuthReq, []byte(s)); err != nil {\n\t\treturn err\n\t}\n\n\t_, data, err := conn.ReadCommand()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !bytes.Contains(data, []byte(`\"result\":\"success\"`)) {\n\t\treturn fmt.Errorf(\"miss: auth: %s\", data)\n\t}\n\n\treturn nil\n}\n\nfunc (c *Client) Version() string {\n\treturn fmt.Sprintf(\"%s (%s)\", c.Conn.Version(), c.model)\n}\n\nfunc (c *Client) WriteCommand(data []byte) error {\n\tdata, err := crypto.Encode(data, c.key)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Conn.WriteCommand(cmdEncoded, data)\n}\n\nconst (","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/xiaomi/miss/client.go#L101-L137","documentation":"login reads the auth command response from the Miss camera and requires it to contain the JSON fragment \"result\":\"success\". If the device responds with anything else (error JSON, empty payload, firmware mismatch output), the raw data is wrapped in this error.","triggerScenarios":"Calling NewClient (which performs login) when the camera's auth response does not contain \"result\":\"success\" — wrong credentials, wrong device, or a device that answered with an error payload.","commonSituations":"Wrong username/password for the Miss device; camera firmware with a different auth response format; connecting to the wrong host/port hitting a different service.","solutions":["Inspect the embedded data in the error for the device's actual response","Verify the Miss credentials and uid used for the connection","Confirm you are connecting to the correct camera host/port","Update the library or camera firmware if the auth protocol version differs"],"exampleFix":"// before\nclient, err := miss.Dial(ctx, \"miss://host?vendor=tutk&uid=X\") // wrong uid\n// after\nclient, err := miss.Dial(ctx, \"miss://host?vendor=tutk&uid=CORRECT_UID_FROM_APP\")","handlingStrategy":"try-catch","validationCode":"if uid == \"\" || host == \"\" { return errors.New(\"uid and host are required for miss Dial\") }","typeGuard":null,"tryCatchPattern":"client, err := miss.Dial(ctx, url)\nif err != nil && strings.Contains(err.Error(), \"miss: auth:\") {\n    log.Printf(\"auth rejected: %s\", strings.TrimPrefix(err.Error(), \"miss: auth: \"))\n    // verify credentials/uid and retry\n}","preventionTips":["Double-check Miss credentials and uid from the vendor app","Confirm firmware compatibility before connecting","Verify the target host actually is the Miss device"],"tags":["miss","authentication","xiaomi"],"backgroundTag":"api-error-response","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"}