{"record":{"id":"d70e330a5608a541","repo":"projectdiscovery/subfinder","slug":"invalid-value-for-filter-regex-option","errorCode":null,"errorMessage":"invalid value for filter regex option","messagePattern":"invalid value for filter regex option","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runner/validate.go","lineNumber":67,"sourceCode":"\tif options.MaxResponseBodySize < 0 {\n\t\treturn fmt.Errorf(\"response-size-read cannot be negative\")\n\t}\n\n\tif options.Match != nil {\n\t\toptions.matchRegexes = make([]*regexp.Regexp, len(options.Match))\n\t\tvar err error\n\t\tfor i, re := range options.Match {\n\t\t\tif options.matchRegexes[i], err = regexp.Compile(stripRegexString(re)); err != nil {\n\t\t\t\treturn errors.New(\"invalid value for match regex option\")\n\t\t\t}\n\t\t}\n\t}\n\tif options.Filter != nil {\n\t\toptions.filterRegexes = make([]*regexp.Regexp, len(options.Filter))\n\t\tvar err error\n\t\tfor i, re := range options.Filter {\n\t\t\tif options.filterRegexes[i], err = regexp.Compile(stripRegexString(re)); err != nil {\n\t\t\t\treturn errors.New(\"invalid value for filter regex option\")\n\t\t\t}\n\t\t}\n\t}\n\n\tsources := mapsutil.GetKeys(passive.NameSourceMap)\n\tfor source := range options.RateLimits.AsMap() {\n\t\tif !sliceutil.Contains(sources, source) {\n\t\t\treturn fmt.Errorf(\"invalid source %s specified in -rls flag\", source)\n\t\t}\n\t}\n\treturn nil\n}\nfunc stripRegexString(val string) string {\n\tval = strings.ReplaceAll(val, \".\", \"\\\\.\")\n\tval = strings.ReplaceAll(val, \"*\", \".*\")\n\treturn fmt.Sprint(\"^\", val, \"$\")\n}\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/projectdiscovery/subfinder/blob/7a0b91f0fac01b62c65328bd771a3560ae611d6a/pkg/runner/validate.go#L49-L85","documentation":"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.","triggerScenarios":"Thrown at pkg/runner/validate.go:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a0b91f0fac01b62c65328bd771a3560ae611d6a","analyzedAt":"2026-09-06T23:52:02.109Z","contentChangedAt":"2026-09-06T23:52:02.109Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}