projectdiscovery/subfinder · error
invalid value for filter regex option
Error message
invalid value for filter regex option
What it means
Compile-time validation failure in Options.validateOptions: one of the -f/--filter regex patterns failed to compile after stripRegexString processing (the underlying regexp.Compile error is discarded and replaced by this sentinel). The offending value is the pattern at the failing index of options.Filter.
Solutions
- Validate each -f pattern with Go's regexp (RE2) syntax — backreferences and lookarounds are not supported
- Quote/shell-escape patterns properly so the CLI passes them through intact
- Log the original compile error when this fires so users can see which filter string is invalid
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/runner/validate.go:67 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/d70e330a5608a541.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/runner/validate.go:67
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)
}
}
return nil
}
func stripRegexString(val string) string {
val = strings.ReplaceAll(val, ".", "\\.")
val = strings.ReplaceAll(val, "*", ".*")
return fmt.Sprint("^", val, "$")
}
View on GitHub (pinned to 7a0b91f0fa)