XTLS/Xray-core · error
failed to determine if address is local:
Error message
failed to determine if address is local:
What it means
The Linux FindProcess first checks whether srcIP belongs to a local interface via IsLocal; that check enumerates network interfaces and failed. The wrapped error after the colon is from net.Interfaces() (e.g. error reading /sys/class/net or netlink). Without knowing the address is local, the /proc-based lookup cannot proceed.
Source
Thrown at common/net/find_process_linux.go:20
package net
import (
"bufio"
"encoding/hex"
"fmt"
"net"
"os"
"strconv"
"strings"
"github.com/xtls/xray-core/common/errors"
)
func FindProcess(network, srcIP string, srcPort uint16, destIP string, destPort uint16) (PID int, Name string, AbsolutePath string, err error) {
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 procFile string
switch network {
case "tcp":
if net.ParseIP(srcIP).To4() != nil {
procFile = "/proc/net/tcp"
} else {
procFile = "/proc/net/tcp6"
}
case "udp":View on GitHub (pinned to 7d214f8b09)
Solutions
- Validate srcIP parses (net.ParseIP(srcIP) != nil) before calling FindProcess
- In containers, ensure /sys/class/net and /proc are properly mounted (not masked)
- Check the wrapped error: if it mentions a specific interface, that interface is in a bad state (dangling link)
- Fall back to non-process routing when the check fails
Example fix
// before
pid, name, path, err := net.FindProcess(network, srcIP, srcPort, dstIP, dstPort)
// after
if ip := net.ParseIP(srcIP); ip == nil {
return fmt.Errorf("invalid srcIP %q", srcIP)
}
pid, name, path, err := net.FindProcess(network, srcIP, srcPort, dstIP, dstPort) Defensive patterns
Strategy: try-catch
Validate before calling
if ip := net.ParseIP(srcIP); ip == nil {
return fmt.Errorf("invalid srcIP %q", srcIP) // IsLocal receives nil otherwise
}
if _, err := net.Interfaces(); err != nil {
// interface enumeration broken; lookup will fail
} Try / catch
if _, _, _, err := net.FindProcess(netw, srcIP, srcPort, dstIP, dstPort); err != nil {
if strings.Contains(err.Error(), "failed to determine if address is local") {
// environment problem (interfaces unreadable), not a routing miss
}
} Prevention
- Validate the source IP before every lookup
- In containers, ensure /proc and /sys/class/net are mounted normally
- Cache the IsLocal failure — it will not self-heal within a process lifetime
When it happens
Trigger: Calling FindProcess on Linux when interface enumeration fails: /sys/class/net unreadable inside a broken container, netlink socket failure in a restricted namespace, or srcIP being nil because net.ParseIP(srcIP) was given a malformed string.
Common situations: Containers with read-only or masked /proc//sys, network namespaces created without interfaces, or callers passing unparsable srcIP so ParseIP returns nil and IsLocal errors on nil input.
Related errors
- could not search in
- failed to format address:
- connection for :: not found in
- could not find PID for inode :
- no process found for inode
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/2a000b667c5a0874.
Report an issue: GitHub.