XTLS/Xray-core · error

failed to determine if address is local: {err}

Error message

failed to determine if address is local: {err}

What it means

Windows FindProcess checks that srcIP is local via IsLocal before consulting the IP Helper tables; that interface enumeration failed and the wrapped error follows the colon (message template shows '{err}'). Without confirming the address is local, the GetExtended{Tcp,Udp}Table search cannot proceed.

Source

Thrown at common/net/find_process_windows.go:62

	getExUDPTable, err = windows.GetProcAddress(h, udpTableFunc)
	if err != nil {
		return errors.New("GetProcAddress of ", udpTableFunc, " failed").Base(err)
	}

	return nil
}

func FindProcess(network, srcIP string, srcPort uint16, destIP string, destPort uint16) (PID int, Name string, AbsolutePath string, err error) {
	once.Do(func() {
		initErr = initWin32API()
	})
	if initErr != nil {
		return 0, "", "", initErr
	}
	isLocal, err := IsLocal(net.ParseIP(srcIP))
	if err != nil {
		return 0, "", "", errors.New("failed to determine if address is local: ", err)
	}
	if !isLocal {
		return 0, "", "", ErrNotLocal
	}
	if network != "tcp" && network != "udp" {
		panic("Unsupported network type for process lookup.")
	}
	var class int
	var fn uintptr
	switch network {
	case "tcp":
		fn = getExTCPTable
		class = tcpTablePidConn
	case "udp":
		fn = getExUDPTable
		class = udpTablePid
	default:
		panic("Unsupported network type for process lookup.")

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Validate srcIP with net.ParseIP != nil before calling FindProcess
  2. If interface enumeration is genuinely broken, run 'netsh winsock reset' and reboot
  3. Disable/re-enable the suspect virtual adapter (VPN filters often break GetAdaptersAddresses mid-transition)
  4. Fall back to routing rules that do not need the process

Example fix

// before
pid, name, path, err := net.FindProcess(network, srcIP, srcPort, dstIP, dstPort)

// after
if net.ParseIP(srcIP) == nil {
    return errors.New("invalid srcIP: ", srcIP)
}
pid, name, path, err := net.FindProcess(network, srcIP, srcPort, dstIP, dstPort)
Defensive patterns

Strategy: try-catch

Validate before calling

if net.ParseIP(srcIP) == nil {
    return errors.New("invalid srcIP: ", srcIP) // nil IP breaks IsLocal
}
if _, err := net.Interfaces(); err != nil {
    // Winsock/interface stack unhealthy; lookup will fail
}

Try / catch

if err != nil && strings.Contains(err.Error(), "failed to determine if address is local") {
    // environment/input issue, not a routing miss; skip process rules
}

Prevention

When it happens

Trigger: net.Interfaces() failing on Windows (rare): broken Winsock catalog, NIC driver in a bad state, or srcIP malformed so net.ParseIP(srcIP) returned nil and IsLocal received a nil IP.

Common situations: Passing empty/invalid srcIP from upstream metadata; systems with a corrupted Winsock stack (fixable with netsh winsock reset); VPN virtual adapters in transition states.

Related errors


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