{"record":{"id":"a4a927dd0a3029ba","repo":"XX-net/XX-Net","slug":"https-create-conn-to-s-d-fail","errorCode":null,"errorMessage":"https create conn to %s:%d fail","messagePattern":"https create conn to (.+?):(.+?) fail","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"code/default/x_tunnel/local/proxy_handler.py","lineNumber":317,"sourceCode":"            version = b\"HTTP/1.1\"\n        else:\n            xlog.warn(\"https req line fail:%s\", line)\n            return\n\n        if command != \"ONNECT\":\n            xlog.warn(\"https req line fail:%s\", line)\n            return\n\n        host, _, port = path.rpartition(':')\n        host = host.encode()\n        port = int(port)\n\n        header_block = self.read_headers()\n\n        sock = self.connection\n        conn_id = proxy_session.create_conn(sock, host, port)\n        if not conn_id:\n            xlog.warn(\"https create conn to %s:%d fail\", host, port)\n            sock.send(b'HTTP/1.1 500 Fail\\r\\n\\r\\n')\n            return\n\n        xlog.info(\"https %r connect to %s:%d conn:%d\", self.client_address, host, port, conn_id)\n        try:\n            sock.send(b'HTTP/1.1 200 OK\\r\\n\\r\\n')\n        except:\n            xlog.warn(\"https %r connect to %s:%d conn:%d closed.\", self.client_address, host, port, conn_id)\n\n        if (len(self.read_buffer) - self.buffer_start) > 0:\n            g.session.conn_list[conn_id].transfer_received_data(self.read_buffer[self.buffer_start:])\n\n        g.session.conn_list[conn_id].start(block=True)\n\n    def http_handler(self, first_char):\n        req_line = self.read_crlf_line()\n        words = req_line.split()\n        if len(words) == 3:","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/x_tunnel/local/proxy_handler.py#L299-L335","documentation":"HTTP CONNECT handshake parsed, but proxy_session.create_conn failed to create a tunnel to host:port, so the proxy replies 'HTTP/1.1 500 Fail' and closes.","triggerScenarios":"HTTPS browsing while the x-tunnel session is down, not logged in, quota exhausted, or fronts unavailable so create_conn returns nothing.","commonSituations":"Session expired/never established, missing account config, all fronts blocked.","solutions":["Verify x-tunnel login/session is up","Check balance and front availability (see errors 223/227)","Restart the client if the session is wedged"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if not g.session:\n    establish_session_first()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify login/quota/fronts before browsing HTTPS"],"tags":["x-tunnel","http-proxy","connect","tunnel"],"backgroundTag":"proxy-upstream-connect-failed","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}