{"record":{"id":"17b84eb0180f8925","repo":"AlexxIT/go2rtc","slug":"dvrip-wrong-packet-0-16x","errorCode":null,"errorMessage":"dvrip: wrong packet: %0.16x","messagePattern":"dvrip: wrong packet: %0\\.16x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/dvrip/client.go","lineNumber":188,"sourceCode":"\t}\n\n\treturn\n}\n\nfunc (c *Client) ReadPacket() (pType byte, payload []byte, err error) {\n\tvar b []byte\n\n\t// many cameras may split packet to multiple chunks\n\t// some rare cameras may put multiple packets to single chunk\n\tfor len(c.buf) < 16 {\n\t\tif b, err = c.ReadChunk(); err != nil {\n\t\t\treturn 0, nil, err\n\t\t}\n\t\tc.buf = append(c.buf, b...)\n\t}\n\n\tif !bytes.HasPrefix(c.buf, []byte{0, 0, 1}) {\n\t\treturn 0, nil, fmt.Errorf(\"dvrip: wrong packet: %0.16x\", c.buf)\n\t}\n\n\tvar size int\n\n\tswitch pType = c.buf[3]; pType {\n\tcase 0xFC, 0xFE:\n\t\tsize = int(binary.LittleEndian.Uint32(c.buf[12:])) + 16\n\tcase 0xFD: // PFrame\n\t\tsize = int(binary.LittleEndian.Uint32(c.buf[4:])) + 8\n\tcase 0xFA, 0xF9:\n\t\tsize = int(binary.LittleEndian.Uint16(c.buf[6:])) + 8\n\tdefault:\n\t\treturn 0, nil, fmt.Errorf(\"dvrip: unknown packet type: %X\", pType)\n\t}\n\n\tfor len(c.buf) < size {\n\t\tif b, err = c.ReadChunk(); err != nil {\n\t\t\treturn 0, nil, err","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/dvrip/client.go#L170-L206","documentation":"ReadPacket reassembled 16 bytes from chunk reads but the buffer does not start with the expected 00 00 01 DVRIP packet prefix, so the stream is not a valid DVRIP packet. The first 16 bytes are hex-dumped in the message; raised by ReadPacket, called from Start and probe.","triggerScenarios":"Thrown at pkg/dvrip/client.go:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reconnect to the camera to resynchronize the session","Verify the camera actually speaks the DVRIP protocol on this port","Check credentials/login state, since error responses can corrupt framing"],"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"}