{"record":{"id":"1a619c20e37f92f6","repo":"AlexxIT/go2rtc","slug":"failed-to-decrypt-packet","errorCode":null,"errorMessage":"failed to decrypt packet","messagePattern":"failed to decrypt packet","errorType":"error_code","errorClass":"protocol.TemporaryError","httpStatus":null,"severity":"error","filePath":"pkg/tutk/dtls/cipher.go","lineNumber":28,"sourceCode":"\t\"sync/atomic\"\n\n\t\"github.com/pion/dtls/v3\"\n\t\"github.com/pion/dtls/v3/pkg/crypto/clientcertificate\"\n\t\"github.com/pion/dtls/v3/pkg/crypto/prf\"\n\t\"github.com/pion/dtls/v3/pkg/protocol\"\n\t\"github.com/pion/dtls/v3/pkg/protocol/recordlayer\"\n\t\"golang.org/x/crypto/chacha20poly1305\"\n)\n\nconst CipherSuiteID_CCAC dtls.CipherSuiteID = 0xCCAC\n\nconst (\n\tchachaTagLength   = 16\n\tchachaNonceLength = 12\n)\n\nvar (\n\terrDecryptPacket      = &protocol.TemporaryError{Err: errors.New(\"failed to decrypt packet\")}\n\terrCipherSuiteNotInit = &protocol.TemporaryError{Err: errors.New(\"CipherSuite not initialized\")}\n)\n\ntype ChaCha20Poly1305Cipher struct {\n\tlocalCipher, remoteCipher   cipher.AEAD\n\tlocalWriteIV, remoteWriteIV []byte\n}\n\nfunc NewChaCha20Poly1305Cipher(localKey, localWriteIV, remoteKey, remoteWriteIV []byte) (*ChaCha20Poly1305Cipher, error) {\n\tlocalCipher, err := chacha20poly1305.New(localKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tremoteCipher, err := chacha20poly1305.New(remoteKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tutk/dtls/cipher.go#L10-L46","documentation":"TUTK DTLS cipher sentinel (protocol.TemporaryError): ChaCha20Poly1305Cipher.Decrypt's remoteCipher.Open failed to decrypt/authenticate an incoming record; the underlying crypto error is wrapped with %w. Marked temporary because a stray/corrupt record need not kill the connection — pion's DTLS stack drops and moves on.","triggerScenarios":"Thrown at pkg/tutk/dtls/cipher.go:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Let the DTLS layer drop the record; treat as transient unless frequent","If persistent: keys are out of sync — restart the DTLS handshake/session","Check MTU/fragmentation issues corrupting records in transit"],"exampleFix":null,"handlingStrategy":"retry","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-16T04:17:20.429Z"}