AlexxIT/go2rtc · error

wrong auth response

Error message

wrong auth response

What it means

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.

Solutions

  1. Re-check the camera username/password used in Dial and retry with correct credentials.
  2. Update the camera firmware to a version compatible with this driver (the 44-byte auth payload shape is version-specific).
  3. Verify you are using the correct driver for the camera model (bubble vs. other ONVIF/proprietary drivers).
  4. Reboot/re-pair the camera to clear stale auth state, then Dial again.
  5. If it persists, capture the raw auth packet and compare cmd/fields to diagnose a protocol change.

Example fix

// before: wrong password leads to rejected auth packet
conn, err := bubble.Dial(ctx, log, addr, "admin", "wrongpass")
// after
conn, err := bubble.Dial(ctx, log, addr, "admin", "correct-camera-password")
Defensive patterns

Strategy: try-catch

Try / catch

client, err := bubble.Dial(ctx, log, addr, user, pass)
if err != nil && err.Error() == "wrong auth response" {
    return fmt.Errorf("camera auth rejected or protocol mismatch: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/f100d3a36890c637. Report an issue: GitHub.

Appendix: source

Thrown at pkg/bubble/client.go:122

		copy(b[8:], u.User.Username())
		pass, _ := u.User.Password()
		copy(b[28:], pass)
	} else {
		copy(b[8:], "admin")
	}

	if err = c.Write(PacketAuth, 0x0E16C271, b); err != nil {
		return
	}

	// 3. Read response
	cmd, b, err := c.Read()
	if err != nil {
		return
	}

	if cmd != PacketAuth || len(b) != 44 || b[4] != 3 || b[8] != 1 {
		return errors.New("wrong auth response")
	}

	// 4. Parse XML (from 1)
	query := u.Query()

	stream := query.Get("stream")
	if stream != "" {
		c.stream = core.Atoi(stream)
	} else {
		stream = "0"
	}

	// <bubble version="1.0" vin="1"><vin0 stream="2">
	// <stream0 name="720p.264" size="2304x1296" x1="yes" x2="yes" x4="yes" />
	// <stream1 name="360p.265" size="640x360" x1="yes" x2="yes" x4="yes" />
	// <vin0>
	// </bubble>
	re := regexp.MustCompile("<stream" + stream + " [^>]+")

View on GitHub (pinned to c245815e75)