epi052/feroxbuster · error

Could not determine initial targets

Error message

Could not determine initial targets: {}

What it means

wrapped_main wraps the get_targets call; when it fails (documented as only happening when reading from stdin errors), it cleans up running tasks and bails with this message, embedding the underlying error. It means the scanner could not assemble its initial target list, so no scan can start.

Solutions

  1. Ensure the upstream command in the pipe succeeds and outputs valid URLs
  2. Pass targets with -u/--urls instead of stdin to bypass stdin reading
  3. Check the inner error text (shown after the colon) for the root cause
  4. Verify stdin encoding/permissions in CI or non-interactive shells

Example fix

// before
maybe-failing-cmd | ferox --stdin
// after
maybe-failing-cmd > urls.txt && ferox --stdin < urls.txt  # or ferox -u https://t.com
Defensive patterns

Strategy: try-catch

Validate before calling

const input = require('fs').readFileSync(0, 'utf8'); if (!/^https?:\/\//m.test(input)) throw new Error('stdin has no valid target URLs');

Try / catch

try { ... } catch (e) { if (String(e).startsWith('Could not determine initial targets')) { /* inspect inner cause: stdin read failure; fall back to -u targets */ } }

Prevention

When it happens

Trigger: Targets supplied via stdin (e.g. from a pipe like cat urls.txt | ferox) when the stdin read fails — closed/broken pipe, invalid bytes, or an inner get_targets failure such as the dont-scan footgun checks bubbling up.

Common situations: Piping from a command that failed midway (breaking the pipe), piping binary/invalid data, or running ferox in an environment with no stdin attached while relying on piped input.

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 epi052/feroxbuster@1f595dab5c (2026-09-13). Data as JSON: /api/errors/f7de22d3d5617173. Report an issue: GitHub.

Appendix: source

Thrown at src/main.rs:385

    if config.resumed {
        let scanned_urls = handles.ferox_scans()?;
        let from_here = config.resume_from.clone();

        // populate FeroxScans object with previously seen scans
        scanned_urls.add_serialized_scans(&from_here, handles.clone())?;

        // populate Stats object with previously known statistics
        handles.stats.send(LoadStats(from_here))?;
    }

    // get targets from command line or stdin
    let targets = match get_targets(handles.clone()).await {
        Ok(t) => t,
        Err(e) => {
            // should only happen in the event that there was an error reading from stdin
            clean_up(handles, tasks).await?;
            bail!("Could not determine initial targets: {}", e);
        }
    };

    // --parallel branch
    if config.parallel > 0 {
        log::trace!("enter: parallel branch");

        PARALLEL_LIMITER.add_permits(config.parallel);

        let invocation = args();

        let para_regex = Regex::new("--stdin").unwrap();

        // remove stdin since only the original process will process targets
        // remove quiet and silent so we can force silent later to normalize output
        let mut original = invocation
            .filter(|s| !para_regex.is_match(s))
            .collect::<Vec<String>>();

View on GitHub (pinned to 1f595dab5c)