shadow1ng/fscan · error

fscan: at least one target is required

Error message

fscan: at least one target is required

What it means

Top-level validation in pkg/fscan validateConfig: the scanner was started with an empty targets slice, so there is nothing to scan. It fires before plugin and per-target checks and means the caller must supply at least one Target (embedded-API equivalent of running fscan with no host).

Source

Thrown at pkg/fscan/scanner.go:335

	cfg.Output.DisableSave = true
	cfg.Output.Silent = true
	cfg.Output.DisableProgress = true
	cfg.Output.ShowProgress = false

	session := common.NewScanSession(cfg, state, fv)
	session.ResultSink = sink

	if opts.controller != nil {
		session.PauseGate = opts.controller.pauseGate
		opts.controller.addState(state)
	}

	return core.RunScan(ctx, info, session)
}

func validateConfig(config Config, targets []Target) error {
	if len(targets) == 0 {
		return fmt.Errorf("fscan: at least one target is required")
	}
	for _, name := range normalizePlugins(config.Plugins) {
		if !plugins.Exists(name) {
			return fmt.Errorf("fscan: plugin %q not found", name)
		}
		if !config.AllowUnsafePlugins && !IsSafePlugin(name) {
			return fmt.Errorf("fscan: plugin %q is not enabled for embedded safe mode", name)
		}
	}
	for _, target := range targets {
		if strings.TrimSpace(target.Host) == "" && strings.TrimSpace(target.URL) == "" {
			return fmt.Errorf("fscan: target host or URL is required")
		}
		if strings.TrimSpace(target.Host) != "" && strings.TrimSpace(target.URL) != "" {
			return fmt.Errorf("fscan: target cannot set both Host and URL")
		}
		for _, port := range target.Ports {
			if port < 1 || port > 65535 {

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Supply at least one Target with Host or URL set
  2. Load targets from a file if specifying inline is impractical
  3. Validate target input before constructing the Scanner
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/fscan/scanner.go:335 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/ec4fe7ad3712ab70. Report an issue: GitHub.