shadow1ng/fscan · error
parser_cidr_failed: %w
Error message
parser_cidr_failed: %w
What it means
Inside parseHostString, any comma-separated token containing '/' is treated as a CIDR and parsed by parseIPCIDR. On failure the error is wrapped with 'parser_cidr_failed' plus the offending token. It signals an invalid CIDR expression in the host list.
Source
Thrown at common/parsers/parsers.go:122
return nil, err
}
hosts = append(hosts, cidrHosts...)
case h == "172":
cidrHosts, err := parseIPCIDR("172.16.0.0/12")
if err != nil {
return nil, err
}
hosts = append(hosts, cidrHosts...)
case h == "10":
cidrHosts, err := parseIPCIDR("10.0.0.0/8")
if err != nil {
return nil, err
}
hosts = append(hosts, cidrHosts...)
case strings.Contains(h, "/"):
cidrHosts, err := parseIPCIDR(h)
if err != nil {
return nil, fmt.Errorf(i18n.Tr("parser_cidr_failed", h)+": %w", err)
}
hosts = append(hosts, cidrHosts...)
case strings.Contains(h, "-") && !strings.Contains(h, ":") && looksLikeIPRange(h):
rangeHosts, err := parseIPRangeString(h)
if err != nil {
return nil, fmt.Errorf(i18n.Tr("parser_ip_range_failed", h)+": %w", err)
}
hosts = append(hosts, rangeHosts...)
default:
hosts = append(hosts, h)
}
}
return hosts, nil
}
// =============================================================================
// 端口解析View on GitHub (pinned to 95cc12e753)
Solutions
- Fix the CIDR in the host argument (valid IPv4 + mask 0-32), e.g. 192.168.1.0/24
- Remove non-CIDR tokens that merely contain '/'
- Validate with net.ParseCIDR before calling ParseIP
- If IPv6 is needed, confirm library support first — the matcher is IPv4-only
Example fix
// before
ParseIP("10.0.0.0/33", "")
// after
ParseIP("10.0.0.0/32", "") Defensive patterns
Strategy: validation
Validate before calling
func validCIDR(s string) bool {
ip, _, err := net.ParseCIDR(s)
return err == nil && ip.To4() != nil
} Try / catch
hosts, err := parsers.ParseIP(host, "")
if err != nil {
if strings.Contains(err.Error(), "parser_cidr_failed") {
log.Fatalf("fix CIDR in %q: %v", host, err)
}
return err
} Prevention
- Validate CIDR tokens with net.ParseCIDR before calling ParseIP
- Keep masks within 0-32 for IPv4
- Don't include non-CIDR strings containing '/' in target lists
When it happens
Trigger: parseHostString (called from ParseIP) encounters a token with '/' that net.ParseCIDR rejects — bad mask like '10.0.0.0/33', non-IP before the slash, or an IPv6 CIDR when only IPv4 is supported.
Common situations: Typos in netmasks, pasting 'host/path' strings accidentally, or using IPv6 CIDRs with an IPv4-only scanner.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- parser_ip_range_failed: %w
- parser_invalid_start_ip
- parser_invalid_end_ip
- parser_cidr_failed: %w
- parser_ipv4_only
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/6655bdb59ca02649.
Report an issue: GitHub.