XTLS/Xray-core · error
failed to read command
Error message
failed to read command
What it means
Error "failed to read command" thrown in XTLS/Xray-core.
Source
Thrown at proxy/trojan/protocol.go:174
Flow string
headerParsed bool
}
// ParseHeader parses the trojan protocol header
func (c *ConnReader) ParseHeader() error {
var crlf [2]byte
var command [1]byte
var hash [56]byte
if _, err := io.ReadFull(c.Reader, hash[:]); err != nil {
return errors.New("failed to read user hash").Base(err)
}
if _, err := io.ReadFull(c.Reader, crlf[:]); err != nil {
return errors.New("failed to read crlf").Base(err)
}
if _, err := io.ReadFull(c.Reader, command[:]); err != nil {
return errors.New("failed to read command").Base(err)
}
network := net.Network_TCP
if command[0] == commandUDP {
network = net.Network_UDP
}
addr, port, err := addrParser.ReadAddressPort(nil, c.Reader)
if err != nil {
return errors.New("failed to read address and port").Base(err)
}
c.Target = net.Destination{Network: network, Address: addr, Port: port}
if _, err := io.ReadFull(c.Reader, crlf[:]); err != nil {
return errors.New("failed to read crlf").Base(err)
}
c.headerParsed = trueView on GitHub (pinned to 7d214f8b09)
When it happens
Trigger: Thrown at proxy/trojan/protocol.go:174 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/c5e3fa7e7c62adb0.
Report an issue: GitHub.