{"record":{"id":"86f52f9e4291a55b","repo":"AlexxIT/go2rtc","slug":"wyze-av-login-failed-w","errorCode":null,"errorMessage":"wyze: av login failed: %w","messagePattern":"wyze: av login failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wyze/client.go","lineNumber":326,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"wyze: connect failed: %w\", err)\n\t}\n\n\tc.conn = conn\n\tif c.verbose {\n\t\tfmt.Printf(\"[Wyze] Connected to %s (IOTC + DTLS)\\n\", conn.RemoteAddr())\n\t}\n\n\treturn nil\n}\n\nfunc (c *Client) doAVLogin() error {\n\tif c.verbose {\n\t\tfmt.Printf(\"[Wyze] Sending AV Login\\n\")\n\t}\n\n\tif err := c.conn.AVClientStart(5 * time.Second); err != nil {\n\t\treturn fmt.Errorf(\"wyze: av login failed: %w\", err)\n\t}\n\n\tif c.verbose {\n\t\tfmt.Printf(\"[Wyze] AV Login response received\\n\")\n\t}\n\treturn nil\n}\n\nfunc (c *Client) doKAuth() error {\n\t// Step 1: K10000 -> K10001 (Challenge)\n\tdata, err := c.conn.WriteAndWaitIOCtrl(c.buildK10000(), c.matchHL(KCmdChallenge), 5*time.Second)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wyze: K10001 failed: %w\", err)\n\t}\n\n\thlData := c.extractHL(data)\n\tchallenge, status, err := c.parseK10001(hlData)\n\tif err != nil {","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/wyze/client.go#L308-L344","documentation":"doAVLogin performs the AV-layer login (AVClientStart, 5s timeout) after the DTLS tunnel is up. If the camera does not answer the AV start request within 5s or rejects it, the error is wrapped as \"wyze: av login failed\".","triggerScenarios":"AVClientStart times out after 5 seconds; camera closes the AV channel during login; DTLS succeeded but the AV server side is not ready; camera firmware rejects the AV session (too many existing viewers).","commonSituations":"Another client already holds the camera's AV session (single-viewer limit); camera rebooting mid-connect; slow network causing the 5s timeout; firmware incompatibility with the AV protocol.","solutions":["Retry Dial after a few seconds — transient AV login timeouts are common on busy cameras.","Close other viewers/apps streaming from the camera (single-session limit).","Check firmware version compatibility; update the camera firmware.","If timeouts persist, verify network latency and consider increasing tolerance/retry count in your own retry loop."],"exampleFix":"// before\nclient.Dial()\n\n// after\nvar err error\nfor i := 0; i < 3; i++ {\n    if err = client.Dial(); err == nil {\n        break\n    }\n    if strings.Contains(err.Error(), \"av login failed\") {\n        time.Sleep(2 * time.Second)\n    }\n}","handlingStrategy":"retry","validationCode":"if !client.IsConnected() {\n    return fmt.Errorf(\"transport not connected\")\n}","typeGuard":null,"tryCatchPattern":"if err := client.Dial(); err != nil {\n    if strings.Contains(err.Error(), \"av login failed\") {\n        time.Sleep(2 * time.Second)\n        err = client.Dial()\n    }\n    if err != nil {\n        return err\n    }\n}","preventionTips":["Close other viewers — the camera typically allows one AV session","Retry on the first AV timeout; it's often transient","Keep camera firmware current"],"tags":["go","timeout","iot","handshake"],"backgroundTag":"request-timeout","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"}