{"record":{"id":"2d48201ac53b9751","repo":"owasp-amass/amass","slug":"ip-address-parsing-failed","errorCode":null,"errorMessage":"IP address parsing failed","messagePattern":"IP address parsing failed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scope.go","lineNumber":344,"sourceCode":"// ParseIPs represents a slice of net.IP addresses.\ntype ParseIPs []net.IP\n\nfunc (p *ParseIPs) String() string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\n\tvar ipaddrs []string\n\tfor _, ipaddr := range *p {\n\t\tipaddrs = append(ipaddrs, ipaddr.String())\n\t}\n\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","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/scope.go#L326-L362","documentation":"ParseIPs.Set (flag.Value interface) was invoked with an empty string as the -cidr/ip flag value, so there is nothing to split into ranges or individual addresses and the guard fires immediately. Any non-empty input proceeds to parseRange/net.ParseIP handling instead.","triggerScenarios":"Calling Set(\"\") on a ParseIPs flag value — e.g. an empty command-line flag value (--ips=) or programmatic assignment of an empty string instead of skipping the call.","commonSituations":"Shell variable holding the IP list is empty when expanded into the flag; scripting that always passes --ips=$IPS even when unset.","solutions":["Only pass the flag when the value is non-empty (guard in the wrapper script)","Provide at least one IP or range, e.g. --ips=192.168.1.0-192.168.1.255","Default the variable before expansion: IPS=${IPS:-192.168.1.1}"],"exampleFix":"// before\namass enum -ips=$IPS   # IPS empty -> error\n// after\n[ -n \"$IPS\" ] && amass enum -ips=\"$IPS\"","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(ipsArg) == \"\" { skipFlag = true } // don't pass --ips at all","typeGuard":"func nonEmpty(s string) bool { return strings.TrimSpace(s) != \"\" }","tryCatchPattern":"if err := parseIPs.Set(value); err != nil { return fmt.Errorf(\"--ips flag: %w\", err) }","preventionTips":["Default IP env vars before flag expansion","Conditionally include flags only when set","Validate IP inputs with net.ParseIP before passing","Never pass empty strings to flag.Value Set implementations"],"tags":["cli","validation","ip-address"],"backgroundTag":"empty-required-field","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}