shadow1ng/fscan · error

fscan: target host or URL is required

Error message

fscan: target host or URL is required

What it means

Per-target validation in pkg/fscan validateConfig: a Target entry has both an empty Host and an empty URL (whitespace-only counts as empty), so the target carries no address to connect to. It fires only after target-count and plugin checks passed, catching malformed Target structs built by the caller.

Solutions

  1. Populate either Target.Host or Target.URL
  2. Filter empty targets out of the list before scanning
  3. Fix target-source parsing that produced blank entries
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/fscan/scanner.go:347 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/242ff121ea7d6210. Report an issue: GitHub.

Appendix: source

Thrown at pkg/fscan/scanner.go:347

	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 {
				return fmt.Errorf("fscan: invalid port %d", port)
			}
		}
	}
	for _, port := range config.Ports {
		if port < 1 || port > 65535 {
			return fmt.Errorf("fscan: invalid port %d", port)
		}
	}
	return nil
}

View on GitHub (pinned to 95cc12e753)