{"record":{"id":"7bc3a3d515266ee6","repo":"XX-net/XX-Net","slug":"check-fail-s-except-r","errorCode":null,"errorMessage":"check fail:%s except:%r","messagePattern":"check fail:(.+?) except:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/x_tunnel/local/cloudflare_front/check_ip.py","lineNumber":109,"sourceCode":"                    continue\n\n    def write_ip(self, ip, host, handshake):\n        with self.lock:\n            self.out_fd.write(\"%s %s gws %s 0 0\\n\" % (ip, host, handshake))\n            self.out_fd.flush()\n\n    def checker(self):\n        while True:\n            try:\n                ip, handshake_time = self.get_ip()\n            except Exception as e:\n                xlog.info(\"no ip left\")\n                return\n\n            try:\n                res = self.check_ip.check_ip(ip, sni=host, host=host)\n            except Exception as e:\n                xlog.warn(\"check fail:%s except:%r\", e)\n                continue\n\n            if not res or not res.ok:\n                xlog.debug(\"check fail:%s fail\", ip)\n                continue\n\n            self.write_ip(ip, res.domain, handshake_time)\n\n    def run(self):\n        for i in range(0, 10):\n            threading.Thread(target=self.checker).start()\n\n\ndef check_all_ip(check_ip):\n\n    HostManager(config, logger, default_domain_fn, domain_fn, front)\n    check = CheckAllIp(check_ip, \"scan1.half.autos\")\n    check.run()","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/x_tunnel/local/cloudflare_front/check_ip.py#L91-L127","documentation":"A worker thread in the IP checker caught an exception while calling check_ip for an IP/host pair; the IP is skipped. Note the log call passes 'e' into a two-placeholder format ('%s except:%r'), so output is slightly malformed.","triggerScenarios":"checker() loop: check_ip(ip, sni=host, host=host) raises (DNS failure, TLS error, socket timeout).","commonSituations":"Checking many candidate IPs where some are unreachable or misbehave during TLS handshake.","solutions":["Treat as expected when scanning unverified IPs","Filter candidate IPs before scanning","Fix log format string to ('%s except:%r', ip, e) for clarity"],"exampleFix":"// before\nxlog.warn(\"check fail:%s except:%r\", e)\n// after\nxlog.warn(\"check fail:%s except:%r\", ip, e)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = check_ip(ip, sni=host, host=host)\nexcept Exception:\n    continue  # skip bad IP","preventionTips":["Expect some failures when scanning raw IPs","Log both ip and exception for diagnosis"],"tags":["cloudflare","ip-check","exception","tooling"],"backgroundTag":"ip-health-check-failed","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}