projectdiscovery/subfinder · error

hostip flag must be used with RemoveWildcard option

Error message

hostip flag must be used with RemoveWildcard option

What it means

Dependency check in Options.validateOptions: the -hostip flag (resolve and append IPs to results) was enabled without -removeWildcard. Host-IP output relies on wildcard removal to strip DNS wildcard synthesized hosts, so the combination is rejected as a misconfiguration.

Solutions

  1. Add -rw/-removeWildcard alongside -hostip when you want IP output
  2. Drop the -hostip flag if wildcard removal is not desired
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at pkg/runner/validate.go:40

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

	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")

View on GitHub (pinned to 7a0b91f0fa)