{"record":{"id":"c9278dd7c2ea6c90","repo":"owasp-amass/amass","slug":"s-is-not-a-valid-ip-range","errorCode":null,"errorMessage":"%s is not a valid IP range","messagePattern":"(.+?) is not a valid IP range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scope.go","lineNumber":391,"sourceCode":"\t// If s is not a range, try parsing it as a single IP\n\tif twoIPs[0] == s {\n\t\tip := net.ParseIP(s)\n\t\tif ip == nil {\n\t\t\treturn fmt.Errorf(\"%s is not a valid IP\", s)\n\t\t}\n\t\treturn p.appendIPs([]net.IP{ip})\n\t}\n\tstart := net.ParseIP(twoIPs[0])\n\tend := net.ParseIP(twoIPs[1])\n\tif end == nil {\n\t\tnum, err := strconv.Atoi(twoIPs[1])\n\t\tif err == nil {\n\t\t\tend = net.ParseIP(twoIPs[0])\n\t\t\tend[len(end)-1] = byte(num)\n\t\t}\n\t}\n\tif start == nil || end == nil {\n\t\treturn fmt.Errorf(\"%s is not a valid IP range\", s)\n\t}\n\n\tips := amassnet.RangeHosts(start, end)\n\tif len(ips) == 0 {\n\t\treturn fmt.Errorf(\"%s is not a valid IP range\", s)\n\t}\n\treturn p.appendIPs(ips)\n}\n","sourceCodeStart":373,"sourceCodeEnd":400,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/scope.go#L373-L400","documentation":"After splitting a range token on '-' and possibly expanding a shorthand last octet, parseRange validates that both start and end parse as IPs. If either is nil, the token is rejected as an invalid IP range. It means a dash-separated scope entry has a malformed endpoint.","triggerScenarios":"Calling Set/populate with a range like '10.0.0.1-' (missing end), '-10.0.0.1' (missing start), or 'abc-def' where neither endpoint parses via net.ParseIP.","commonSituations":"Truncated lines in scope config files, accidental extra dashes splitting a token incorrectly (e.g. '10.0.0.1--10.0.0.5'), or ranges mixing IPs and hostnames.","solutions":["Provide both endpoints as full valid IPs: 'startIP-endIP'","Check for stray or doubled dash characters in the scope entry","Rewrite shorthand ranges explicitly if the automatic last-octet expansion does not apply"],"exampleFix":"// before\nscope.Set(\"10.0.0.1-10.0.0\")\n// after\nscope.Set(\"10.0.0.1-10.0.0.254\")","handlingStrategy":"validation","validationCode":"func checkRange(s string) error {\n\tparts := strings.Split(s, \"-\")\n\tif len(parts) != 2 {\n\t\treturn fmt.Errorf(\"range %q must be start-end\", s)\n\t}\n\tif net.ParseIP(parts[0]) == nil || net.ParseIP(parts[1]) == nil {\n\t\treturn fmt.Errorf(\"range %q has an invalid endpoint\", s)\n\t}\n\treturn nil\n}","typeGuard":"func isWellFormedRange(s string) bool {\n\tparts := strings.Split(s, \"-\")\n\treturn len(parts) == 2 && net.ParseIP(parts[0]) != nil && net.ParseIP(parts[1]) != nil\n}","tryCatchPattern":"if err := scope.Set(rng); err != nil && strings.Contains(err.Error(), \"is not a valid IP range\") {\n\tlog.Printf(\"dropping malformed range %q\", rng)\n}","preventionTips":["Always provide both endpoints of a range","Avoid extra dash characters inside range tokens","Validate ranges before writing them to config"],"tags":["config","ip-range","validation","amass"],"backgroundTag":"invalid-config-value","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}