XX-net/XX-Net · error

socks5 create conn to %s:%d fail

Error message

socks5 create conn to %s:%d fail

What it means

SOCKS5 CONNECT succeeded syntactically but proxy_session.create_conn returned no conn_id, so the tunnel to %s:%d could not be created and a generic failure reply (0x01) is sent.

Source

Thrown at code/default/x_tunnel/local/proxy_handler.py:271

        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:
            xlog.warn("request address type unknown:%d", addrtype)
            sock.send(b"\x05\x07\x00\x01")  # Command not supported
            return

        port = struct.unpack('>H', self.rfile.read(2))[0]

        conn_id = proxy_session.create_conn(sock, addr, port)
        if not conn_id:
            xlog.warn("socks5 create conn to %s:%d fail", addr, port)
            reply = b"\x05\x01\x00" + addrtype_pack + addr_pack + struct.pack(">H", port)
            sock.send(reply)
            return

        xlog.info("socks5 %r connect to %s:%d conn:%d", self.client_address, addr, port, conn_id)
        reply = b"\x05\x00\x00" + addrtype_pack + addr_pack + struct.pack(">H", port)
        try:
            sock.send(reply)
        except Exception as e:
            if conn_id in g.session.conn_list:
                g.session.conn_list[conn_id].do_stop("close_on_Socks5_reply")
            xlog.warn("socks5 %r connect to %s:%d conn_id:%d closed:%r", self.client_address, addr, port, conn_id, e)
            return

        if len(self.read_buffer) - self.buffer_start:
            g.session.conn_list[conn_id].transfer_received_data(self.read_buffer[self.buffer_start:])

        g.session.conn_list[conn_id].start(block=True)

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Confirm x-tunnel login and active session
  2. Check balance (request_balance) and front availability
  3. Restart the x-tunnel client if the session is stuck
Defensive patterns

Strategy: fallback

Validate before calling

if not proxy_session.create_conn(sock, addr, port):
    report_session_unavailable()

Prevention

When it happens

Trigger: SOCKS5 CONNECT while the x-tunnel session is down/not logged in, out of quota, or front connectivity fails so create_conn cannot be issued.

Common situations: Session expired, missing login credentials, quota exhausted, all fronts dead.

Related errors


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