{"record":{"id":"1fa1fe56c0190cd1","repo":"XTLS/Xray-core","slug":"failed-to-read-payload","errorCode":null,"errorMessage":"failed to read payload","messagePattern":"failed to read payload","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/trojan/protocol.go","lineNumber":255,"sourceCode":"\tif _, err := io.ReadFull(r, crlf[:]); err != nil {\n\t\treturn nil, errors.New(\"failed to read crlf\").Base(err)\n\t}\n\n\tdest := net.UDPDestination(addr, port)\n\tvar mb buf.MultiBuffer\n\tfor remain > 0 {\n\t\tlength := buf.Size\n\t\tif remain < length {\n\t\t\tlength = remain\n\t\t}\n\n\t\tb := buf.New()\n\t\tb.UDP = &dest\n\t\tmb = append(mb, b)\n\t\tn, err := b.ReadFullFrom(r, int32(length))\n\t\tif err != nil {\n\t\t\tbuf.ReleaseMulti(mb)\n\t\t\treturn nil, errors.New(\"failed to read payload\").Base(err)\n\t\t}\n\n\t\tremain -= int(n)\n\t}\n\n\treturn mb, nil\n}\n","sourceCodeStart":237,"sourceCodeEnd":263,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/trojan/protocol.go#L237-L263","documentation":"PacketReader.ReadMultiBuffer fails reading the declared payload body (in buf.Size chunks) from the UDP stream; the chained read error means the connection ended mid-datagram, and already allocated buffers are released.","triggerScenarios":"Thrown at proxy/trojan/protocol.go:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect .Base(err) for the read cause","Check connection stability and MTU on the UDP path"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","contentChangedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}