{"record":{"id":"e668d0f4fc9532ae","repo":"grafana/k6","slug":"failed-to-parse-cidr-s-w","errorCode":null,"errorMessage":"failed to parse CIDR '%s': %w","messagePattern":"failed to parse CIDR '(.+?)': %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/options.go","lineNumber":205,"sourceCode":"\t\treturn nil, err\n\t}\n\tkey = pem.EncodeToMemory(&pem.Block{\n\t\tType:  blockType,\n\t\tBytes: decryptedKey,\n\t})\n\treturn key, nil\n}\n\n// IPNet is a wrapper around net.IPNet for JSON unmarshalling\ntype IPNet struct {\n\tnet.IPNet\n}\n\n// UnmarshalText populates the IPNet from the given CIDR\nfunc (ipnet *IPNet) UnmarshalText(b []byte) error {\n\tnewIPNet, err := ParseCIDR(string(b))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse CIDR '%s': %w\", string(b), err)\n\t}\n\n\t*ipnet = *newIPNet\n\treturn nil\n}\n\n// MarshalText encodes the IPNet representation using CIDR notation.\nfunc (ipnet *IPNet) MarshalText() ([]byte, error) {\n\treturn []byte(ipnet.String()), nil\n}\n\n// ParseCIDR creates an IPNet out of a CIDR string\nfunc ParseCIDR(s string) (*IPNet, error) {\n\t_, ipnet, err := net.ParseCIDR(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/options.go#L187-L223","documentation":"Raised by IPNet.UnmarshalText while parsing a blocked hostnames/IP entry: the value is not valid CIDR notation, and the underlying parsing error is wrapped with %w. This feeds the hosts/blockHostnames options.","triggerScenarios":"Thrown at lib/options.go:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid CIDR such as 10.0.0.0/8","For single IPs, use the address with a /32 (IPv4) or /128 (IPv6) suffix or a plain IP form accepted by the parser"],"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"}