projectdiscovery/subfinder · error

invalid source specified in -rls flag

Error message

invalid source %s specified in -rls flag

What it means

The -rls (rate-limit per source) flag only accepts keys that are known passive source names, checked against passive.NameSourceMap. If a rate-limit key is not one of the built-in source names, validateOptions rejects it with this error.

Solutions

  1. List the valid sources and use the exact name as the -rls key (e.g. -rls 'github=10/m')
  2. Check the release notes/docs for renamed or removed sources in your subfinder version
  3. Upgrade or downgrade subfinder so the source name matches the version in use

Example fix

// before
subfinder -d example.com -rls 'Github=10/m'
// after
subfinder -d example.com -rls 'github=10/m'
Defensive patterns

Strategy: validation

Validate before calling

sources := mapsutil.GetKeys(passive.NameSourceMap)
for source := range rateLimits.AsMap() {
    if !sliceutil.Contains(sources, source) {
        return fmt.Errorf("unknown rate-limit source: %s", source)
    }
}

Try / catch

opts, err := runner.ParseOptions()
if err != nil && strings.Contains(err.Error(), "invalid source") {
    // strip -rls or correct source name, retry
}

Prevention

When it happens

Trigger: Running with -rls containing a key not present in passive.NameSourceMap, e.g. a misspelled or renamed source (source names change between releases).

Common situations: Typo'd source names in scripts; following outdated documentation after a source was renamed or removed; using an alias that is not the canonical source key.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of projectdiscovery/subfinder@7a0b91f0fa (2026-09-06). Data as JSON: /api/errors/978ddf98a8a14767. Report an issue: GitHub.

Appendix: source

Thrown at pkg/runner/validate.go:75

			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, "$")
}

// ConfigureOutput configures the output on the screen
func (options *Options) ConfigureOutput() {
	// If the user desires verbose output, show verbose output
	if options.Verbose {
		gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose)
	}
	if options.NoColor {
		gologger.DefaultLogger.SetFormatter(formatter.NewCLI(true))

View on GitHub (pinned to 7a0b91f0fa)