AlexxIT/go2rtc · error

hap: wrong DeviceID:

Error message

hap: wrong DeviceID: 

What it means

HAP client pairing M6 verification guard: the accessory's signature validated, but the Identifier in the Pair-Setup response does not match the DeviceID the client configured (plainM6.Identifier appended). The client is talking to (or configured for) a different accessory than expected — a pairing-target mismatch.

Solutions

  1. Check the DeviceID in the source URL/config against the code printed on the accessory
  2. Reset pairing on both sides and re-pair to the correct device
  3. Verify no proxy/redirect is routing to a different accessory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/hap/client_pairing.go:270 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at pkg/hap/client_pairing.go:270

	if err = tlv8.Unmarshal(b, &plainM6); err != nil {
		return
	}

	// STEP M6. Verify payload
	remoteSign, err := hkdf.Sha512(
		sessionShared, "Pair-Setup-Accessory-Sign-Salt", "Pair-Setup-Accessory-Sign-Info",
	)
	if err != nil {
		return
	}

	b = Append(remoteSign, plainM6.Identifier, plainM6.PublicKey)
	if !ed25519.ValidateSignature([]byte(plainM6.PublicKey), b, []byte(plainM6.Signature)) {
		return errors.New("hap: ValidateSignature")
	}

	if c.DeviceID != plainM6.Identifier {
		return errors.New("hap: wrong DeviceID: " + plainM6.Identifier)
	}

	c.DevicePublic = []byte(plainM6.PublicKey)

	return nil
}

func (c *Client) ListPairings() error {
	plainM1 := struct {
		Method byte `tlv8:"0"`
		State  byte `tlv8:"6"`
	}{
		Method: MethodListPairings,
		State:  StateM1,
	}
	res, err := c.Post(PathPairings, MimeTLV8, tlv8.MarshalReader(plainM1))
	if err != nil {
		return err

View on GitHub (pinned to c245815e75)