grafana/k6 · error
hostname matches a blocked pattern
Error message
hostname %s matches a blocked pattern %q
What it means
Deterministic policy rejection: the request's hostname matches a pattern configured in the k6 blockHosts option (a HostnameTrie), so the network manager blocks it before it is sent. The offending input is the site's hostname relative to the user's blockHosts configuration.
Solutions
- Remove or narrow the matching blockHosts pattern if the host should be reachable
- Add the host to allowlist or adjust the trie so legitimate traffic is not blocked
- Intentionally blocked: assert the block in the test instead of trying to continue
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/network_manager.go:729 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18).
Data as JSON: /api/errors/f26b42f0934a3f6b.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/network_manager.go:729
return
}
// Do one last check of the resolved IP
ip, err = m.resolver.LookupIP(host)
if err != nil {
m.logger.Debugf("NetworkManager:onRequestPaused",
"resolving %q: %s", host, err)
return
}
failErr = checkBlockedIPs(ip, state.Options.BlacklistIPs)
}
func checkBlockedHosts(host string, blockedHosts *k6types.HostnameTrie) error {
if blockedHosts == nil {
return nil
}
if match, blocked := blockedHosts.Contains(host); blocked {
return fmt.Errorf("hostname %s matches a blocked pattern %q", host, match)
}
return nil
}
func checkBlockedIPs(ip net.IP, blockedIPs []*k6lib.IPNet) error {
for _, ipnet := range blockedIPs {
if ipnet.Contains(ip) {
// TODO: Return netext.BlackListedIPError here once its private
// fields are exported, or there's a constructor for it.
return fmt.Errorf("IP %s is in a blacklisted range %q", ip, ipnet)
}
}
return nil
}
func (m *NetworkManager) onAuthRequired(event *fetch.EventAuthRequired) {
var (
res = fetch.AuthChallengeResponseResponseDefaultView on GitHub (pinned to 8d06114777)