VictoriaMetrics/VictoriaMetrics · error

cannot create dialer for proxy_url=%q connection: %w

Error message

cannot create dialer for proxy_url=%q connection: %w

What it means

Returned by newClient (lib/promscrape/client.go) when it cannot build the network dialer for a scrape going through proxy_url (HTTP-Connect or SOCKS5 tunnel). It typically fires on invalid proxy_url scheme or proxy TLS/auth configuration; the wrapped error is the dialer construction failure.

Source

Thrown at lib/promscrape/client.go:86

		}
		// case for direct http proxy connection.
		// must be used for http based scrape targets
		// since standard golang http.transport has special case for it
		if strings.HasPrefix(sw.ScrapeURL, "http://") {
			if proxyURL.URL.Scheme == "https" {
				ac = sw.ProxyAuthConfig
			}
			proxyURLFunc = http.ProxyURL(proxyURL.URL)
			setProxyHeaders = func(req *http.Request) error {
				return proxyURL.SetHeaders(sw.ProxyAuthConfig, req)
			}
		} else {
			// HTTP-Connect or socks5 proxy tunnel
			// it makes possible to use separate tls configurations
			// for proxy and backend connections
			proxyDial, err := proxyURL.NewDialFunc(sw.ProxyAuthConfig)
			if err != nil {
				return nil, fmt.Errorf("cannot create dialer for proxy_url=%q connection: %w", proxyURL, err)
			}
			dialFunc = netutil.NewStatDialFuncWithDial("vm_promscrape", proxyDial)
		}
	}

	tr := httputil.NewTransport(false, "vm_promscrape")
	if sw.UnixSocket != "" {
		// Unix sockets are direct local endpoints and cannot be reached via HTTP proxies.
		// Proxy could be set implicitly via global env variable HTTP_PROXY
		tr.Proxy = nil
	} else if proxyURLFunc != nil {
		tr.Proxy = proxyURLFunc
	}
	tr.TLSHandshakeTimeout = 10 * time.Second
	tr.IdleConnTimeout = 2 * sw.ScrapeInterval
	tr.DisableKeepAlives = *disableKeepAlive || sw.DisableKeepAlive
	tr.DialContext = dialFunc
	tr.MaxIdleConnsPerHost = 100

View on GitHub (pinned to 5079fb58f1)

Solutions

  1. Verify the `proxy_url` host:port is correct and reachable
  2. Check DNS and firewall rules for the proxy from the VictoriaMetrics host
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at lib/promscrape/client.go:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03). Data as JSON: /api/errors/71d13b78961c6744. Report an issue: GitHub.