{"record":{"id":"f100d3a36890c637","repo":"AlexxIT/go2rtc","slug":"wrong-auth-response","errorCode":null,"errorMessage":"wrong auth response","messagePattern":"wrong auth response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bubble/client.go","lineNumber":122,"sourceCode":"\t\tcopy(b[8:], u.User.Username())\n\t\tpass, _ := u.User.Password()\n\t\tcopy(b[28:], pass)\n\t} else {\n\t\tcopy(b[8:], \"admin\")\n\t}\n\n\tif err = c.Write(PacketAuth, 0x0E16C271, b); err != nil {\n\t\treturn\n\t}\n\n\t// 3. Read response\n\tcmd, b, err := c.Read()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif cmd != PacketAuth || len(b) != 44 || b[4] != 3 || b[8] != 1 {\n\t\treturn errors.New(\"wrong auth response\")\n\t}\n\n\t// 4. Parse XML (from 1)\n\tquery := u.Query()\n\n\tstream := query.Get(\"stream\")\n\tif stream != \"\" {\n\t\tc.stream = core.Atoi(stream)\n\t} else {\n\t\tstream = \"0\"\n\t}\n\n\t// <bubble version=\"1.0\" vin=\"1\"><vin0 stream=\"2\">\n\t// <stream0 name=\"720p.264\" size=\"2304x1296\" x1=\"yes\" x2=\"yes\" x4=\"yes\" />\n\t// <stream1 name=\"360p.265\" size=\"640x360\" x1=\"yes\" x2=\"yes\" x4=\"yes\" />\n\t// <vin0>\n\t// </bubble>\n\tre := regexp.MustCompile(\"<stream\" + stream + \" [^>]+\")","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/bubble/client.go#L104-L140","documentation":"During bubble.Dial (pkg/bubble/client.go:122), after the HTTP handshake succeeds the client reads an authentication packet with c.Read() and validates it: the command must be PacketAuth, the payload must be exactly 44 bytes, b[4] must equal 3, and b[8] must equal 1. Any deviation returns \"wrong auth response\". This means the camera answered the auth exchange, but with a payload the driver does not recognize as a successful authentication, typically a rejection or an incompatible protocol version.","triggerScenarios":"Dial, Unpair, TestTimeout, or TestMissedControl when the camera's auth reply has wrong cmd, a payload length other than 44 bytes, b[4] != 3, or b[8] != 1 — i.e. auth rejected or protocol mismatch.","commonSituations":"Wrong password for the Bubble camera (auth rejected); camera firmware speaking a different auth protocol version than the driver expects; connecting to a similar but incompatible camera model; MITM or corrupted stream truncating the auth payload.","solutions":["Re-check the camera username/password used in Dial and retry with correct credentials.","Update the camera firmware to a version compatible with this driver (the 44-byte auth payload shape is version-specific).","Verify you are using the correct driver for the camera model (bubble vs. other ONVIF/proprietary drivers).","Reboot/re-pair the camera to clear stale auth state, then Dial again.","If it persists, capture the raw auth packet and compare cmd/fields to diagnose a protocol change."],"exampleFix":"// before: wrong password leads to rejected auth packet\nconn, err := bubble.Dial(ctx, log, addr, \"admin\", \"wrongpass\")\n// after\nconn, err := bubble.Dial(ctx, log, addr, \"admin\", \"correct-camera-password\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"client, err := bubble.Dial(ctx, log, addr, user, pass)\nif err != nil && err.Error() == \"wrong auth response\" {\n    return fmt.Errorf(\"camera auth rejected or protocol mismatch: %w\", err)\n}","preventionTips":["Confirm the password in a camera web UI before wiring it into the client","Keep camera firmware on a driver-supported version","Re-pair the device if auth state is stale","Match driver to exact camera model"],"tags":["authentication","camera","protocol","handshake"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}