{"record":{"id":"2a105d1269ec2105","repo":"AlexxIT/go2rtc","slug":"hap","errorCode":null,"errorMessage":"hap: ","messagePattern":"hap: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hap/client_pairing.go","lineNumber":387,"sourceCode":"\tswitch code {\n\tcase 1:\n\t\ttext = \"Generic error to handle unexpected errors\"\n\tcase 2:\n\t\ttext = \"Setup code or signature verification failed\"\n\tcase 3:\n\t\ttext = \"Client must look at the retry delay TLV item and wait that many seconds before retrying\"\n\tcase 4:\n\t\ttext = \"Server cannot accept any more pairings\"\n\tcase 5:\n\t\ttext = \"Server reached its maximum number of authentication attempts\"\n\tcase 6:\n\t\ttext = \"Server pairing method is unavailable\"\n\tcase 7:\n\t\ttext = \"Server is busy and cannot accept a pairing request at this time\"\n\tdefault:\n\t\ttext = \"Unknown pairing error\"\n\t}\n\treturn errors.New(\"hap: \" + text)\n}\n\nfunc keyDerivativeFuncRFC2945(username []byte) srp.KeyDerivationFunc {\n\treturn func(salt, password []byte) []byte {\n\t\th1 := sha512.New()\n\t\th1.Write(username)\n\t\th1.Write([]byte(\":\"))\n\t\th1.Write(password)\n\n\t\th2 := sha512.New()\n\t\th2.Write(salt)\n\t\th2.Write(h1.Sum(nil))\n\n\t\treturn h2.Sum(nil)\n\t}\n}\n","sourceCodeStart":369,"sourceCodeEnd":404,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/hap/client_pairing.go#L369-L404","documentation":"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.","triggerScenarios":"Thrown at pkg/hap/client_pairing.go:387 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Match the text to the code table: for the retry-delay case wait the indicated seconds then retry","For setup-code failures verify the PIN and start pairing over","For max pairings / busy errors remove stale pairings or retry later on the accessory"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}