projectdiscovery/subfinder · error

threads cannot be zero

Error message

threads cannot be zero

What it means

Sanity check in Options.validateOptions: the -t/--threads value resolved to zero (unset or explicitly 0), which would give the enumeration worker pool no goroutines. The zero value is rejected so the runner can fall back to or demand a positive concurrency setting.

Solutions

  1. Set a positive thread count, e.g. -t 10 (the flag's default when properly bound)
  2. If building Options programmatically, populate options.Threads with a positive default before calling validateOptions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/runner/validate.go:32 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/b1f06099c550da50. Report an issue: GitHub.

Appendix: source

Thrown at pkg/runner/validate.go:32

	sliceutil "github.com/projectdiscovery/utils/slice"
)

// validateOptions validates the configuration options passed
func (options *Options) validateOptions() error {
	// Check if domain, list of domains, or stdin info was provided.
	// If none was provided, then return.
	if len(options.Domain) == 0 && options.DomainsFile == "" && !options.Stdin {
		return errors.New("no input list provided")
	}

	// Both verbose and silent flags were used
	if options.Verbose && options.Silent {
		return errors.New("both verbose and silent mode specified")
	}

	// Validate threads and options
	if options.Threads == 0 {
		return errors.New("threads cannot be zero")
	}
	if options.Timeout == 0 {
		return errors.New("timeout cannot be zero")
	}

	// Always remove wildcard with hostip
	if options.HostIP && !options.RemoveWildcard {
		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")

View on GitHub (pinned to 7a0b91f0fa)