XTLS/Xray-core · error
failed to read payload
Error message
failed to read payload
What it means
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.
Solutions
- Inspect .Base(err) for the read cause
- Check connection stability and MTU on the UDP path
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at proxy/trojan/protocol.go:255 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/1fa1fe56c0190cd1.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/trojan/protocol.go:255
if _, err := io.ReadFull(r, crlf[:]); err != nil {
return nil, errors.New("failed to read crlf").Base(err)
}
dest := net.UDPDestination(addr, port)
var mb buf.MultiBuffer
for remain > 0 {
length := buf.Size
if remain < length {
length = remain
}
b := buf.New()
b.UDP = &dest
mb = append(mb, b)
n, err := b.ReadFullFrom(r, int32(length))
if err != nil {
buf.ReleaseMulti(mb)
return nil, errors.New("failed to read payload").Base(err)
}
remain -= int(n)
}
return mb, nil
}
View on GitHub (pinned to 7d214f8b09)