xai-org/x-algorithm · error · std::io::Error

NotFound

NotFound

Error message

DNS resolution returned 0 addresses for {}

What it means

After parsing host:port from copy_url, DNS resolution (to_socket_addrs) succeeded structurally but returned zero addresses. The proxy then returns NotFound because it has nothing to dial.

Source

Thrown at phoenix/crates/serving/xai-recsys-engine/src/checkpoint_proxy.rs:106

    async fn resolve_and_connect(&self) -> Result<Vec<transport::Channel>, io::Error> {
        let (scheme, hostport) = if let Some(rest) = self.copy_url.strip_prefix("https://") {
            ("https", rest)
        } else {
            ("http", self.copy_url.trim_start_matches("http://"))
        };
        let tls = crate::tls::ClientTlsOptions::from_env()?;
        let (name, port) = hostport.rsplit_once(':').ok_or_else(|| {
            io::Error::new(
                io::ErrorKind::InvalidInput,
                format!("copy_url must be host:port, got {}", self.copy_url),
            )
        })?;

        let addrs: Vec<SocketAddr> = format!("{}:{}", name, port).to_socket_addrs()?.collect();

        if addrs.is_empty() {
            return Err(io::Error::new(
                io::ErrorKind::NotFound,
                format!("DNS resolution returned 0 addresses for {}", name),
            ));
        }

        let dns_count = addrs.len();

        let connect_timeout = std::time::Duration::from_secs(
            std::env::var("COPY_PORT_CONNECT_TIMEOUT_SECS")
                .ok()
                .and_then(|s| s.parse().ok())
                .unwrap_or(10),
        );

        let request_timeout = self.request_timeout;

        let mut endpoints = Vec::with_capacity(addrs.len());
        for addr in &addrs {

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Verify the hostname resolves: 'getent hosts <name>' or 'dig <name>' from the same pod
  2. Fix the DNS record or /etc/hosts entry to point at the trainer
  3. If transient, retry; but prefer correcting resolution since it usually recurs
Defensive patterns

Strategy: retry

Validate before calling

use std::net::ToSocketAddrs;
let n = (host, port).to_socket_addrs()?.count();
if n == 0 { /* re-resolve or abort with clear message */ }

Try / catch

Catch io::ErrorKind::NotFound around resolve_and_connect and retry DNS a bounded number of times with backoff.

Prevention

When it happens

Trigger: to_socket_addrs returning an empty iterator for the configured trainer host — rare but possible with resolver quirks, an empty hosts-file entry, or a name resolving to zero A/AAAA records.

Common situations: DNS misconfiguration, stale /etc/hosts entry, IPv6-only name with IPv6 disabled, or transient resolver behavior in the cluster.

Understand the failure class


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/40f2ad303d60dd1d. Report an issue: GitHub.