AlexxIT/go2rtc · error

hap:

Error message

hap: 

What it means

newPairingError maps a HAP server TLV error code to a human explanation (generic error, setup-code/signature failure, retry-delay required, max pairings, max auth attempts, method unavailable, busy, or unknown). The 'hap: ' prefix plus that text is returned when the accessory reports an error state during a pairing step; the specific code determines whether it is transient or fatal.

Solutions

  1. Match the text to the code table: for the retry-delay case wait the indicated seconds then retry
  2. For setup-code failures verify the PIN and start pairing over
  3. For max pairings / busy errors remove stale pairings or retry later on the accessory
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/hap/client_pairing.go:387 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/2a105d1269ec2105. Report an issue: GitHub.

Appendix: source

Thrown at pkg/hap/client_pairing.go:387

	switch code {
	case 1:
		text = "Generic error to handle unexpected errors"
	case 2:
		text = "Setup code or signature verification failed"
	case 3:
		text = "Client must look at the retry delay TLV item and wait that many seconds before retrying"
	case 4:
		text = "Server cannot accept any more pairings"
	case 5:
		text = "Server reached its maximum number of authentication attempts"
	case 6:
		text = "Server pairing method is unavailable"
	case 7:
		text = "Server is busy and cannot accept a pairing request at this time"
	default:
		text = "Unknown pairing error"
	}
	return errors.New("hap: " + text)
}

func keyDerivativeFuncRFC2945(username []byte) srp.KeyDerivationFunc {
	return func(salt, password []byte) []byte {
		h1 := sha512.New()
		h1.Write(username)
		h1.Write([]byte(":"))
		h1.Write(password)

		h2 := sha512.New()
		h2.Write(salt)
		h2.Write(h1.Sum(nil))

		return h2.Sum(nil)
	}
}

View on GitHub (pinned to c245815e75)