{"record":{"id":"2b74942b94bfd00a","repo":"AlexxIT/go2rtc","slug":"wyze-k10003-parse-failed-w","errorCode":null,"errorMessage":"wyze: K10003 parse failed: %w","messagePattern":"wyze: K10003 parse failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wyze/client.go","lineNumber":362,"sourceCode":"\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}\n\n\tif c.verbose && authResp != nil {\n\t\tif jsonBytes, err := json.MarshalIndent(authResp, \"\", \"  \"); err == nil {\n\t\t\tfmt.Printf(\"[Wyze] K10003 response:\\n%s\\n\", jsonBytes)\n\t\t}\n\t}\n\n\t// Extract audio capability from cameraInfo\n\tif authResp != nil && authResp.CameraInfo != nil {\n\t\tif channelResult, ok := authResp.CameraInfo[\"channelRequestResult\"].(map[string]any); ok {\n\t\t\tif audio, ok := channelResult[\"audio\"].(string); ok {\n\t\t\t\tc.hasAudio = audio == \"1\"\n\t\t\t} else {\n\t\t\t\tc.hasAudio = true\n\t\t\t}\n\t\t} else {\n\t\t\tc.hasAudio = true","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/wyze/client.go#L344-L380","documentation":"After the K10002/K10003 exchange, doKAuth parses the K10003 auth-result payload with parseK10003. If the payload cannot be parsed (missing/malformed HL framing or fields), the error is wrapped as \"wyze: K10003 parse failed\".","triggerScenarios":"Camera sent a K10003 whose HL payload doesn't match the expected structure; error/status frame returned instead of a normal auth result; truncated packet received.","commonSituations":"Firmware sending an auth-rejection payload with a different layout; wrong credentials leading to an alternate response shape; protocol drift after a camera firmware update.","solutions":["Enable verbose mode and log the raw HL bytes to see the actual K10003 payload.","Verify UID/authKey/enr are valid — rejections often come back in an unexpected shape.","Check the wrapped parse error for specifics (missing magic, short data) and compare with the expected K10003 schema.","Retry once; if reproducible, the camera's firmware response format likely 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(), \"K10003 parse failed\") {\n        return fmt.Errorf(\"camera rejected auth in unexpected format — check credentials/firmware: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate UID/authKey/enr freshness before dialing","Enable verbose mode to inspect raw K10003 bytes","Test against known-good firmware versions"],"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"}