{"record":{"id":"1ae88c16fa7fccf8","repo":"AlexxIT/go2rtc","slug":"wrong-message-prefix","errorCode":null,"errorMessage":"wrong message prefix","messagePattern":"wrong message prefix","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/roborock/iot/crypto.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"crypto/aes\"\n\t\"crypto/md5\"\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"hash/crc32\"\n)\n\n// key - convert timestamp to key\nfunc (c *Codec) key(timestamp uint32) []byte {\n\tconst salt = \"TXdfu$jyZ#TZHsg4\"\n\tkey := md5.Sum([]byte(encodeTimestamp(timestamp) + c.devKey + salt))\n\treturn key[:]\n}\n\nfunc (c *Codec) Decrypt(cipherText []byte) ([]byte, error) {\n\tif len(cipherText) < 32 || string(cipherText[:3]) != \"1.0\" {\n\t\treturn nil, errors.New(\"wrong message prefix\")\n\t}\n\n\ti := len(cipherText) - 4\n\tif binary.BigEndian.Uint32(cipherText[i:]) != crc32.ChecksumIEEE(cipherText[:i]) {\n\t\treturn nil, errors.New(\"wrong message checksum\")\n\t}\n\n\tif proto := binary.BigEndian.Uint16(cipherText[15:]); proto != 102 {\n\t\treturn nil, nil\n\t}\n\n\ttimestamp := binary.BigEndian.Uint32(cipherText[11:])\n\treturn decryptECB(cipherText[19:i], c.key(timestamp)), nil\n}\n\nfunc (c *Codec) Encrypt(plainText []byte, seq, random, timestamp uint32) []byte {\n\tconst proto = 101\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/roborock/iot/crypto.go#L2-L38","documentation":"Roborock IoT Decrypt guard: the ciphertext is shorter than 32 bytes or does not start with the expected '1.0' protocol version prefix, so it is not a valid Roborock encrypted IPC message. Usually means desynced framing, wrong devKey, or a non-Roborock endpoint responding.","triggerScenarios":"Thrown at pkg/roborock/iot/crypto.go:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the local devKey matches the device","Check that the connection is talking to the Roborock IoT endpoint and framing is intact","Reconnect to resynchronize the message stream"],"exampleFix":null,"handlingStrategy":"validation","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"}