{"record":{"id":"3123128caaeff6bd","repo":"grafana/k6","slug":"s-is-not-a-valid-ip-ip-range-or-cidr","errorCode":null,"errorMessage":"%s is not a valid IP, IP range or CIDR","messagePattern":"(.+?) is not a valid IP, IP range or CIDR","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/types/ipblock.go","lineNumber":37,"sourceCode":"type ipPoolBlock struct {\n\tfirstIP, startIndex *big.Int\n}\n\n// IPPool represent a slice of IPBlocks\ntype IPPool struct {\n\tlist  []ipPoolBlock\n\tcount *big.Int\n}\n\nfunc getIPBlock(s string) (*ipBlock, error) {\n\tswitch {\n\tcase strings.Contains(s, \"-\"):\n\t\treturn ipBlockFromRange(s)\n\tcase strings.Contains(s, \"/\"):\n\t\treturn ipBlockFromCIDR(s)\n\tdefault:\n\t\tif net.ParseIP(s) == nil {\n\t\t\treturn nil, fmt.Errorf(\"%s is not a valid IP, IP range or CIDR\", s)\n\t\t}\n\t\treturn ipBlockFromRange(s + \"-\" + s)\n\t}\n}\n\nfunc ipBlockFromRange(s string) (*ipBlock, error) {\n\tip0Str, ip1Str, _ := strings.Cut(s, \"-\")\n\tip0, ip1 := net.ParseIP(ip0Str), net.ParseIP(ip1Str)\n\tif ip0 == nil || ip1 == nil {\n\t\treturn nil, errors.New(\"wrong IP range format: \" + s)\n\t}\n\tif (ip0.To4() == nil) != (ip1.To4() == nil) { // XOR\n\t\treturn nil, errors.New(\"mixed IP range format: \" + s)\n\t}\n\tblock := ipBlockFromTwoIPs(ip0, ip1)\n\n\tif block.count.Sign() <= 0 {\n\t\treturn nil, errors.New(\"negative IP range: \" + s)","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/types/ipblock.go#L19-L55","documentation":"Raised by getIPBlock while building an IP pool (e.g. for external IP / ipBlock options): the string is neither parseable as a single IP (net.ParseIP fails) nor shaped like a range or CIDR, so no block can be constructed.","triggerScenarios":"Thrown at lib/types/ipblock.go:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid single IP (192.168.0.1), a range (192.168.0.0-192.168.0.255) or CIDR (192.168.0.0/24)","Check for typos, stray characters or wrong IP version mixing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}