grafana/k6 · error

IP is in a blacklisted range

Error message

IP %s is in a blacklisted range %q

What it means

Deterministic policy rejection: the resolved IP of the request falls inside a CIDR range listed in the k6 blacklistIPs option, so the request is aborted. The offending inputs are the DNS resolution result and the user's blacklistIPs configuration.

Solutions

  1. Remove or shrink the matching blacklistIPs CIDR if the destination must be reached
  2. Pin a different DNS resolution or host mapping to avoid the blocked IP
  3. Treat as expected when blacklisting is intentional; assert the abort
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/network_manager.go:739 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/665151e770a76908. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/network_manager.go:739

	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.AuthChallengeResponseResponseDefault
		rid = event.RequestID

		username, password string
	)

	switch {
	case m.attemptedAuth[rid]:
		delete(m.attemptedAuth, rid)
		res = fetch.AuthChallengeResponseResponseCancelAuth
	case !m.credentials.IsEmpty():

View on GitHub (pinned to 8d06114777)