grafana/k6 · error
lookup %s: no such host
Error message
lookup %s: no such host
What it means
Raised by Dialer.findRemote when DNS resolution returns neither an error nor an IP for the requested host — the hostname simply does not exist. It mirrors Go's net.DNS "no such host" error shape for hosts configured through k6's network layer.
Source
Thrown at lib/netext/dialer.go:164
if d.Hosts != nil {
remote, e := d.getConfiguredHost(addr, host, port)
if e != nil || remote != nil {
return remote, e
}
}
if ip != nil {
return types.NewHost(ip, port)
}
ip, err = d.Resolver.LookupIP(host)
if err != nil {
return nil, err
}
if ip == nil {
return nil, fmt.Errorf("lookup %s: no such host", host)
}
return types.NewHost(ip, port)
}
func (d *Dialer) getConfiguredHost(addr, host, port string) (*types.Host, error) {
if remote := d.Hosts.Match(addr); remote != nil {
return remote, nil
}
if remote := d.Hosts.Match(host); remote != nil {
if remote.Port != 0 || port == "" {
return remote, nil
}
newPort, err := strconv.Atoi(port)
if err != nil {
return nil, errView on GitHub (pinned to 01ffac6f24)
Solutions
- Verify the hostname is spelled correctly in the script
- Check DNS resolution from the machine running k6 (e.g. nslookup)
- Map the hostname to an IP via the --host (hosts) option if it should be overridden
- Ensure the DNS policy in K6_DNS is not blocking the lookup
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/netext/dialer.go:164 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/be901e232012ea23.
Report an issue: GitHub.