{"record":{"id":"c2739417d204a944","repo":"owasp-amass/amass","slug":"s-is-not-a-valid-ip-address-or-range","errorCode":null,"errorMessage":"%s is not a valid IP address or range","messagePattern":"(.+?) is not a valid IP address or range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scope.go","lineNumber":356,"sourceCode":"\treturn strings.Join(ipaddrs, \",\")\n}\n\n// Set implements the flag.Value interface.\nfunc (p *ParseIPs) Set(s string) error {\n\tif s == \"\" {\n\t\treturn fmt.Errorf(\"IP address parsing failed\")\n\t}\n\n\tips := strings.Split(s, \",\")\n\tfor _, ip := range ips {\n\t\t// Is this an IP range?\n\t\terr := p.parseRange(ip)\n\t\tif err == nil {\n\t\t\tcontinue\n\t\t}\n\t\taddr := net.ParseIP(ip)\n\t\tif addr == nil {\n\t\t\treturn fmt.Errorf(\"%s is not a valid IP address or range\", ip)\n\t\t}\n\t\t*p = append(*p, addr)\n\t}\n\treturn nil\n}\n\nfunc (p *ParseIPs) appendIPs(addrs []net.IP) error {\n\tfor _, addr := range addrs {\n\t\t*p = append(*p, addr)\n\t}\n\treturn nil\n}\n\nfunc (p *ParseIPs) parseRange(s string) error {\n\ttwoIPs := strings.Split(s, \"-\")\n\n\t// If s is not a range, try parsing it as a single IP\n\tif twoIPs[0] == s {","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/scope.go#L338-L374","documentation":"Set parses each whitespace/comma-separated token in an amass scope input as either an IP range (via parseRange) or a single IP (via net.ParseIP). If a token fails both, this error is returned naming the offending token. It indicates malformed scope input that is neither a CIDR-compatible range nor a valid IP literal.","triggerScenarios":"Calling Config.Set (or the scope population path that calls it) with a token that parseRange rejects and net.ParseIP cannot parse, e.g. '10.0.0.256', 'not-an-ip', '10.0.0.1-abc', or a stray hostname in an IP scope list.","commonSituations":"Hand-edited scope config files with typos, pasting domain names into an IP scope, IPv6 shorthand mistakes, or copy-paste artifacts like trailing punctuation.","solutions":["Check the named token in your scope input and fix the typo or remove the invalid entry","Use only valid IP literals or 'start-end' ranges in IP scope entries; use the domains section for hostnames","Validate tokens with net.ParseIP or a tool like `ipcalc` before adding them to the scope"],"exampleFix":"// before\nscope.Set(\"10.0.0.1, example.com\")\n// after\nscope.Set(\"10.0.0.1\") // IPs and ranges only; hostnames belong in the domains scope","handlingStrategy":"validation","validationCode":"for _, ip := range strings.FieldsFunc(input, func(r rune) bool { return r == ',' || r == ' ' || r == '\\t' || r == '\\n' }) {\n\tif strings.Count(ip, \"-\") == 0 && net.ParseIP(ip) == nil {\n\t\treturn fmt.Errorf(\"invalid scope entry: %q\", ip)\n\t}\n}","typeGuard":"func isValidIPToken(s string) bool { return net.ParseIP(s) != nil }","tryCatchPattern":"if err := scope.Set(input); err != nil {\n\tvar bad string\n\tif _, err2 := fmt.Sscanf(err.Error(), \"%s is not a valid IP address or range\", &bad); err2 == nil {\n\t\tlog.Printf(\"removing invalid scope token %q\", bad)\n\t}\n}","preventionTips":["Validate every scope token with net.ParseIP before calling Set","Keep hostnames out of the IP scope list","Lint scope config files on CI"],"tags":["config","ip-address","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"}