XX-net/XX-Net · warning
DNS server:%s domain:%s fail t:%f
Error message
DNS server:%s domain:%s fail t:%f
What it means
query_json() in the DoH client sends a GET request to the resolver's JSON API (RFC 8484 JSON style, e.g. Cloudflare/Google) and the HTTP client returned a falsy/None response. The request failed before any HTTP data was processed (connection error, blocked request, or the client's internal failure), so an empty IP list is returned.
Source
Thrown at code/default/smart_router/local/dns_query.py:542
}, timeout=self.timeout)
else:
return simple_http_client.Client(timeout=self.timeout)
@property
def server(self):
return random.choice(self.other_servers)
def query_json(self, domain, dns_type=1):
try:
t0 = time.time()
client = self.get_connection()
url = self.server + "?name=" + domain + "&type=A" # type need to map to Text.
r = client.request("GET", url, headers={"accept": "application/dns-json"})
t2 = time.time()
ips = []
if not r:
xlog.warn("DNS server:%s domain:%s fail t:%f", self.server, domain, t2 - t0)
return ips
t = utils.to_str(r.text)
data = json.loads(t)
for answer in data["Answer"]:
ips.append(answer["data"])
self.connections.append([client, time.time()])
xlog.debug("DNS server:%s query:%s return %s t:%f", self.server, domain, ips, t2 - t0)
return ips
except Exception as e:
xlog.warn("DNSOverHttpsQuery query fail:%r", e)
return []
def query(self, domain, dns_type=1, url=None):
t0 = time.time()View on GitHub (pinned to cfa5bc17b6)
Solutions
- Verify the DoH endpoint manually: 'curl -H 'accept: application/dns-json' 'https://1.1.1.1/dns-query?name=example.com&type=A''
- Ensure self.server points at a JSON-capable DoH resolver (Cloudflare, Google) and not a pure RFC8484 wire-format endpoint
- Check proxy/TLS settings of the HTTP client used by this module
- Retry with backoff — transient HTTPS failures are common; consider a second DoH provider as fallback
Defensive patterns
Strategy: retry
Validate before calling
import requests
def doh_endpoint_ok(server):
try:
r = requests.get(server, params={'name': 'example.com', 'type': 'A'},
headers={'accept': 'application/dns-json'}, timeout=5)
return r.status_code == 200 and 'Answer' in r.json()
except Exception:
return False Try / catch
for server in doh_servers: # rotate providers
ips = doh_client.query(domain)
if ips:
break Prevention
- Configure multiple DoH providers and rotate on empty responses
- Verify the endpoint supports the JSON API, not just RFC 8484 wire format
- Always check query() return for emptiness before use; never assume success
When it happens
Trigger: Calling query() on DnsOverHttpsQuery when the HTTPS request to self.server fails to connect or is rejected — DNS URL wrong, proxy required but unavailable, TLS failure, or the endpoint blocked/returning nothing the client accepts.
Common situations: DoH endpoint blocked or hijacked on the network, wrong self.server URL (must support ?name=&type=A JSON API), corporate TLS-inspection proxies breaking the request, no internet connectivity, GFW-style blocking of well-known DoH providers.
Related errors
- DNSOverHttpsQuery query fail:%r
- DoH request no name
- DNS s:%s query:%s fail t:%f
- DnsOverHttpsQuery query %s cost:%f fail:%r
- Servers could not be resolved, %r.
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/4f22233ab69a27cf.
Report an issue: GitHub.