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

  1. Log the byte value to classify corruption vs protocol mismatch.
  2. Align endpoint versions and retest.
  3. In custom implementations, emit only 0, TCP, or UDP in local-address network slots.
  4. 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

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


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/0d34d1bb71c5c21f. Report an issue: GitHub.