XTLS/Xray-core · error
reading local: unknown network type:
Error message
reading local: unknown network type:
What it means
The local-address block's network byte was non-zero but neither TargetNetworkTCP nor TargetNetworkUDP, so FrameMetadata.Unmarshal rejects it. This is the local-destination analogue of error 163 and aborts the whole frame read.
Source
Thrown at common/mux/frame.go:209
if b.Len() == 0 {
return nil
}
network = TargetNetwork(b.Byte(0))
if network == 0 {
return nil
}
b.Advance(1)
addr, port, err = addrParser.ReadAddressPort(nil, b)
if err != nil {
return errors.New("reading local: failed to parse address and port").Base(err)
}
switch network {
case TargetNetworkTCP:
f.Inbound.Local = net.TCPDestination(addr, port)
case TargetNetworkUDP:
f.Inbound.Local = net.UDPDestination(addr, port)
default:
return errors.New("reading local: unknown network type: ", network)
}
return nil
}
// Application data is essential, to test whether the pipe is closed.
if f.SessionStatus == SessionStatusNew && f.Option.Has(OptionData) &&
f.Target.Network == net.Network_UDP && b.Len() >= 8 {
copy(f.GlobalID[:], b.Bytes())
}
return nil
}
View on GitHub (pinned to 7d214f8b09)
Solutions
- Log the byte value to classify corruption vs protocol mismatch.
- Align endpoint versions and retest.
- In custom implementations, emit only 0, TCP, or UDP in local-address network slots.
- Check TLS/transport integrity (disable obfuscation temporarily).
Defensive patterns
Strategy: validation
Try / catch
if err := meta.Unmarshal(reader, true); err != nil {
if strings.Contains(err.Error(), "reading local") {
log.Warn("peer uses incompatible optional address encoding")
}
return err
} Prevention
- Restrict local-address network bytes to defined values or 0.
- Keep client and server versions aligned for reverse mux.
- Fuzz the unmarshaller on your server build.
When it happens
Trigger: readSourceAndLocal=true and the byte after a valid source address holds an undefined network value; caused by corrupt frames or clients with non-conforming local-address encoding.
Common situations: Version drift in reverse mux, hand-crafted frames, or bit-level stream corruption.
Related errors
- reading source: unknown network type:
- bridge tag is empty
- bridge domain is empty
- portal tag is empty
- portal domain is empty
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/0d34d1bb71c5c21f.
Report an issue: GitHub.