{"record":{"id":"933d81547f395c44","repo":"AlexxIT/go2rtc","slug":"wyze-k10001-parse-failed-w","errorCode":null,"errorMessage":"wyze: K10001 parse failed: %w","messagePattern":"wyze: K10001 parse failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wyze/client.go","lineNumber":345,"sourceCode":"\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 {\n\t\treturn fmt.Errorf(\"wyze: K10001 parse failed: %w\", err)\n\t}\n\n\tif c.verbose {\n\t\tfmt.Printf(\"[Wyze] K10001 challenge received, status=%d\\n\", status)\n\t}\n\n\t// Step 2: K10002 -> K10003 (Auth)\n\tdata, err = c.conn.WriteAndWaitIOCtrl(c.buildK10002(challenge, status), c.matchHL(KCmdAuthResult), 5*time.Second)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wyze: K10002 failed: %w\", err)\n\t}\n\thlData = c.extractHL(data)\n\n\t// Parse K10003 response\n\tauthResp, err := c.parseK10003(hlData)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wyze: K10003 parse failed: %w\", err)\n\t}","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/wyze/client.go#L327-L363","documentation":"After receiving the K10001 challenge payload, doKAuth parses it with parseK10001. If parsing fails (bad HL magic, payload shorter than 33 bytes, malformed fields), the error is wrapped as \"wyze: K10001 parse failed\".","triggerScenarios":"Camera returned a K10001 response that is not a valid HL-framed challenge (e.g., an error/status frame instead of a challenge); response truncated on the wire; firmware sends a different K10001 layout than expected.","commonSituations":"Firmware update changed the K10001 payload structure; camera returned an error/auth-reject frame the parser treats as a challenge; corrupted packet over a flaky connection.","solutions":["Log the raw HL payload (verbose mode prints sizes; dump bytes) to inspect what the camera actually sent.","Check the camera status field — a rejected auth may arrive in a non-challenge frame; verify credentials (authKey/enr).","Compare the payload layout against the library's expected K10001 format for your firmware version.","Retry the connection; if consistent, the firmware protocol likely differs and needs a library update."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := client.Dial(); err != nil {\n    if strings.Contains(err.Error(), \"K10001 parse failed\") {\n        // dump raw payload via verbose mode and report firmware incompatibility\n        return fmt.Errorf(\"camera K10001 response unrecognized: %w\", err)\n    }\n    return err\n}","preventionTips":["Enable verbose logging to capture unexpected payloads","Verify credentials — rejection frames often parse as malformed challenges","Track firmware versions known to work with the library"],"tags":["go","iot","protocol","parsing"],"backgroundTag":"unexpected-response-shape","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"}