{"record":{"id":"f26b42f0934a3f6b","repo":"grafana/k6","slug":"hostname-s-matches-a-blocked-pattern-q","errorCode":null,"errorMessage":"hostname %s matches a blocked pattern %q","messagePattern":"hostname (.+?) matches a blocked pattern %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/network_manager.go","lineNumber":729,"sourceCode":"\t\treturn\n\t}\n\n\t// Do one last check of the resolved IP\n\tip, err = m.resolver.LookupIP(host)\n\tif err != nil {\n\t\tm.logger.Debugf(\"NetworkManager:onRequestPaused\",\n\t\t\t\"resolving %q: %s\", host, err)\n\t\treturn\n\t}\n\tfailErr = checkBlockedIPs(ip, state.Options.BlacklistIPs)\n}\n\nfunc checkBlockedHosts(host string, blockedHosts *k6types.HostnameTrie) error {\n\tif blockedHosts == nil {\n\t\treturn nil\n\t}\n\tif match, blocked := blockedHosts.Contains(host); blocked {\n\t\treturn fmt.Errorf(\"hostname %s matches a blocked pattern %q\", host, match)\n\t}\n\treturn nil\n}\n\nfunc checkBlockedIPs(ip net.IP, blockedIPs []*k6lib.IPNet) error {\n\tfor _, ipnet := range blockedIPs {\n\t\tif ipnet.Contains(ip) {\n\t\t\t// TODO: Return netext.BlackListedIPError here once its private\n\t\t\t// fields are exported, or there's a constructor for it.\n\t\t\treturn fmt.Errorf(\"IP %s is in a blacklisted range %q\", ip, ipnet)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (m *NetworkManager) onAuthRequired(event *fetch.EventAuthRequired) {\n\tvar (\n\t\tres = fetch.AuthChallengeResponseResponseDefault","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/network_manager.go#L711-L747","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/network_manager.go:729 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}