XTLS/Xray-core · error
failed to read addons protobuf value
Error message
failed to read addons protobuf value
What it means
DecodeHeaderAddons read a non-zero protobuf length byte but then buffer.ReadFullFrom failed to read that many payload bytes from the connection. This means the stream was truncated or the peer disconnected mid-header — the addons blob announced by the length prefix never arrived; the underlying cause is attached via Base(err).
Solutions
- Treat as a connection-level failure: close the connection and let the client reconnect
- Check for middleboxes/proxies truncating the stream or premature connection teardown
- Verify the remote peer speaks the same VLESS version with matching addon framing
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at proxy/vless/encoding/addons.go:49 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/d4b325f131c6bbba.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/vless/encoding/addons.go:49
if err := buffer.WriteByte(0); err != nil {
return errors.New("failed to write addons protobuf length").Base(err)
}
}
return nil
}
func DecodeHeaderAddons(buffer *buf.Buffer, reader io.Reader) (*Addons, error) {
addons := new(Addons)
buffer.Clear()
if _, err := buffer.ReadFullFrom(reader, 1); err != nil {
return nil, errors.New("failed to read addons protobuf length").Base(err)
}
if length := int32(buffer.Byte(0)); length != 0 {
buffer.Clear()
if _, err := buffer.ReadFullFrom(reader, length); err != nil {
return nil, errors.New("failed to read addons protobuf value").Base(err)
}
if err := proto.Unmarshal(buffer.Bytes(), addons); err != nil {
return nil, errors.New("failed to unmarshal addons protobuf value").Base(err)
}
// Verification.
switch addons.Flow {
default:
}
}
return addons, nil
}
// EncodeBodyAddons returns a Writer that auto-encrypt content written by caller.
func EncodeBodyAddons(writer buf.Writer, request *protocol.RequestHeader, requestAddons *Addons, state *proxy.TrafficState, isUplink bool, context context.Context, conn net.Conn, ob *session.Outbound) buf.Writer {
if request.Command == protocol.RequestCommandUDP {View on GitHub (pinned to 7d214f8b09)