XX-net/XX-Net · warning

request version:%d error

Error message

request version:%d error

What it means

Logged (not raised) by socks5_handler in the smart_router proxy: after the SOCKS5 greeting, the client's request frame reports a version byte other than 5. SOCKS5 requires every frame to start with 0x05; anything else (often 0x04 for SOCKS4, or garbage) is rejected and the handler returns, closing the connection.

Source

Thrown at code/default/smart_router/local/proxy_handler.py:263

        xlog.debug("socks5 from:%r udp associate to %s:%d closed", self.client_address, addr, port)

    def socks5_handler(self):
        sock = self.conn
        socks_version = ord(self.read_bytes(1))
        auth_mode_num = ord(self.read_bytes(1))
        data = self.read_bytes(auth_mode_num)

        sock.send(b"\x05\x00")  # socks version 5, no auth needed.
        try:
            data = self.read_bytes(4)
        except Exception as e:
            xlog.debug("socks5 auth num:%d, list:%s", auth_mode_num, utils.str2hex(data))
            xlog.warn("socks5 protocol error:%r", e)
            return

        socks_version = ord(data[0:1])
        if socks_version != 5:
            xlog.warn("request version:%d error", socks_version)
            return

        command = ord(data[1:2])
        addrtype_pack = data[3:4]
        addrtype = ord(addrtype_pack)
        if addrtype == 1:  # IPv4
            addr_pack = self.read_bytes(4)
            addr = socket.inet_ntoa(addr_pack)
        elif addrtype == 3:  # Domain name
            domain_len_pack = self.read_bytes(1)[0:1]
            domain_len = ord(domain_len_pack)
            domain = self.read_bytes(domain_len)
            addr_pack = domain_len_pack + domain
            addr = domain
        elif addrtype == 4:  # IPv6
            addr_pack = self.read_bytes(16)
            addr = socket.inet_ntop(socket.AF_INET6, addr_pack)
        else:

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Configure the client to use SOCKS5 (e.g. socks5://127.0.0.1:<port>) not SOCKS4
  2. Confirm the client is connecting to the intended local proxy port
  3. If frames are truncated, check for MTU/interception issues between client and proxy

Example fix

# client config
# before
socks4://127.0.0.1:1080

# after
socks5://127.0.0.1:1080
Defensive patterns

Strategy: validation

Validate before calling

# client side: use socks5 scheme
proxy = 'socks5://127.0.0.1:1080'

Prevention

When it happens

Trigger: A client configured for SOCKS4 or speaking a non-SOCKS protocol connects to the local SOCKS5 port; or a malformed request frame arrives after a valid greeting.

Common situations: App/browser proxy settings specify socks4:// instead of socks5://, client library bug, port reuse collision where another protocol connects to the proxy port.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/36433396fbb2356c. Report an issue: GitHub.