projectdiscovery/subfinder · error
invalid value for match regex option
Error message
invalid value for match regex option
What it means
Compile-time validation failure in Options.validateOptions: one of the -m/--match regex patterns failed to compile after stripRegexString processing (the wrapped regexp.Compile error is discarded and replaced by this sentinel). The offending value is the pattern at the failing index of options.Match.
Solutions
- Test the pattern with a small Go program or an online RE2 tester before passing it via -m
- Ensure the pattern is valid Go regexp (RE2) syntax — no backreferences or lookaheads
- Wrap the pattern appropriately; note subfinder strips surrounding quotes/regex delimiters via stripRegexString before compiling
- Print the underlying regexp.Compile error alongside this message to pinpoint the bad expression
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/runner/validate.go:58 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of projectdiscovery/subfinder@7a0b91f0fa (2026-09-06).
Data as JSON: /api/errors/b5cf09816e007517.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/runner/validate.go:58
return errors.New("hostip flag must be used with RemoveWildcard option")
}
// The per-source results limit cannot be negative.
if options.MaxResults < 0 {
return fmt.Errorf("max-results cannot be negative")
}
// The response body size limit cannot be negative.
if options.MaxResponseBodySize < 0 {
return fmt.Errorf("response-size-read cannot be negative")
}
if options.Match != nil {
options.matchRegexes = make([]*regexp.Regexp, len(options.Match))
var err error
for i, re := range options.Match {
if options.matchRegexes[i], err = regexp.Compile(stripRegexString(re)); err != nil {
return errors.New("invalid value for match regex option")
}
}
}
if options.Filter != nil {
options.filterRegexes = make([]*regexp.Regexp, len(options.Filter))
var err error
for i, re := range options.Filter {
if options.filterRegexes[i], err = regexp.Compile(stripRegexString(re)); err != nil {
return errors.New("invalid value for filter regex option")
}
}
}
sources := mapsutil.GetKeys(passive.NameSourceMap)
for source := range options.RateLimits.AsMap() {
if !sliceutil.Contains(sources, source) {
return fmt.Errorf("invalid source %s specified in -rls flag", source)
}View on GitHub (pinned to 7a0b91f0fa)