XTLS/Xray-core · error
failed to decode request header addons
Error message
failed to decode request header addons
What it means
DecodeRequestHeader called DecodeHeaderAddons to parse the length-prefixed addons section and it failed (length read, value read, or protobuf unmarshal). The connection drops at this point since the request cannot be authenticated fully without valid addons framing.
Solutions
- Close the connection and log the chained addon decode cause
- Ensure client/server xray versions agree on the addons format
- Check for stream corruption from proxies or DPI
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at proxy/vless/encoding/encoding.go:105 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/1119114f2578c886.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/vless/encoding/encoding.go:105
buffer.Clear()
if _, err := buffer.ReadFullFrom(reader, 16); err != nil {
return nil, nil, nil, false, errors.New("failed to read request user id").Base(err)
}
copy(id[:], buffer.Bytes())
}
if request.User = validator.Get(id); request.User == nil {
u := uuid.UUID(id)
return nil, nil, nil, isfb, errors.New("invalid request user id: " + u.String())
}
if isfb {
first.Advance(17)
}
requestAddons, err := DecodeHeaderAddons(&buffer, reader)
if err != nil {
return nil, nil, nil, false, errors.New("failed to decode request header addons").Base(err)
}
buffer.Clear()
if _, err := buffer.ReadFullFrom(reader, 1); err != nil {
return nil, nil, nil, false, errors.New("failed to read request command").Base(err)
}
request.Command = protocol.RequestCommand(buffer.Byte(0))
switch request.Command {
case protocol.RequestCommandMux:
request.Address = net.DomainAddress("v1.mux.cool")
case protocol.RequestCommandRvs:
request.Address = net.DomainAddress("v1.rvs.cool")
case protocol.RequestCommandTCP, protocol.RequestCommandUDP:
if addr, port, err := addrParser.ReadAddressPort(&buffer, reader); err == nil {
request.Address = addr
request.Port = port
}View on GitHub (pinned to 7d214f8b09)