owasp-amass/amass · error
%s is not a valid IP
Error message
%s is not a valid IP
What it means
parseRange splits a scope token on '-'; if the token contains no dash it is treated as a single IP. When net.ParseIP cannot parse it, this error is returned. It means a non-range token in the IP scope is not a valid IP address.
Source
Thrown at config/scope.go:377
}
return nil
}
func (p *ParseIPs) appendIPs(addrs []net.IP) error {
for _, addr := range addrs {
*p = append(*p, addr)
}
return nil
}
func (p *ParseIPs) parseRange(s string) error {
twoIPs := strings.Split(s, "-")
// If s is not a range, try parsing it as a single IP
if twoIPs[0] == s {
ip := net.ParseIP(s)
if ip == nil {
return fmt.Errorf("%s is not a valid IP", s)
}
return p.appendIPs([]net.IP{ip})
}
start := net.ParseIP(twoIPs[0])
end := net.ParseIP(twoIPs[1])
if end == nil {
num, err := strconv.Atoi(twoIPs[1])
if err == nil {
end = net.ParseIP(twoIPs[0])
end[len(end)-1] = byte(num)
}
}
if start == nil || end == nil {
return fmt.Errorf("%s is not a valid IP range", s)
}
ips := amassnet.RangeHosts(start, end)
if len(ips) == 0 {View on GitHub (pinned to 79299dce87)
Solutions
- Fix the token to be a full valid IP literal (all four octets / full IPv6)
- If you intended a subnet, express it as an explicit range like 10.0.0.0-10.0.0.255 instead of CIDR
- Remove hostnames from the IP scope and place them in the domain scope
Example fix
// before
scope.Set("10.0.0/24")
// after
scope.Set("10.0.0.0-10.0.0.255") Defensive patterns
Strategy: validation
Validate before calling
func checkSingleIP(s string) error {
if !strings.Contains(s, "-") && net.ParseIP(s) == nil {
return fmt.Errorf("%q is not a valid single IP", s)
}
return nil
} Type guard
func isSingleIP(s string) bool { return !strings.Contains(s, "-") && net.ParseIP(s) != nil } Try / catch
if err := scope.Set(tok); err != nil {
if strings.Contains(err.Error(), "is not a valid IP") {
log.Printf("skipping invalid single IP %q", tok)
}
} Prevention
- Use full four-octet IPv4 or full IPv6 literals
- Do not pass CIDR notation to Set; expand to ranges first
- Strip whitespace and stray characters from config entries
When it happens
Trigger: Calling Set/populate with a single token (no '-') that net.ParseIP rejects: '10.0.0' (missing octet), '999.1.1.1', a hostname, or an empty/whitespace token.
Common situations: Typos in scope files, CIDR notation fed to a parser that expects 'a.b.c.d' or 'a.b.c.d-e.f.g.h' (CIDR like 10.0.0.0/24 is not handled here), or hostnames mixed into IP lists.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- %s is not a valid IP address or range
- invalid IP address in resolvers file: %s
- %s is not a valid IP range
- invalid key delimiter: %s
- brute forcing cannot be performed without DNS resolution
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/06feeaf654568cb2.
Report an issue: GitHub.