epi052/feroxbuster · error

Invalid request: Empty method

Error message

Invalid request: Empty method

What it means

This error is thrown by parse_request_file when the first token of a raw HTTP request line (the method) is an empty string. The library parses a request file's first line into METHOD URI VERSION, and without a method the request cannot be forwarded, so parsing is aborted with this error.

Solutions

  1. Open the request file and ensure the first line starts with a valid HTTP method token followed by a space (e.g. GET / HTTP/1.1)
  2. Remove any leading whitespace or blank lines at the start of the file (head -1 file shows the offending line)
  3. Re-export the request from the original tool (curl -x, burp 'copy as raw') to get a clean request line
  4. Add 'GET / HTTP/1.1' as the first line if the file only contains headers/body

Example fix

// before
let raw = "\n /target HTTP/1.1\nHost: site.com";
// after
let raw = "GET /target HTTP/1.1\nHost: site.com";
Defensive patterns

Strategy: validation

Validate before calling

fn validate_request_raw(raw: &str) -> Result<(), String> {
    let first = raw.lines().next().unwrap_or("");
    let method = first.split_whitespace().next().unwrap_or("");
    if method.is_empty() {
        return Err("request file's first line must start with an HTTP method".into());
    }
    Ok(())
}

Type guard

fn has_method(raw: &str) -> bool {
    raw.lines().next()
        .and_then(|l| l.split_whitespace().next())
        .map(|m| !m.is_empty())
        .unwrap_or(false)
}

Prevention

When it happens

Trigger: Calling parse_request_file (via Config::new) on a request file whose first line starts with whitespace or is blank, e.g. a file beginning with ' /path' or an empty first line, so request_parts.next() yields Some("").

Common situations: Malformed request files exported by hand or copied from browser tools with a leading blank line or missing method; users editing raw request captures in an editor and accidentally deleting the method token.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of epi052/feroxbuster@1f595dab5c (2026-09-13). Data as JSON: /api/errors/890e296465f72600. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:496

    // begin parsing the request line and normalized headers
    let mut head_parts = normalized.split("\n");

    let Some(request_line) = head_parts.next() else {
        bail!("Invalid request: Missing request line");
    };

    if request_line.is_empty() {
        bail!("Invalid request: Empty request line");
    }

    let mut request_parts = request_line.split_whitespace();

    let Some(method) = request_parts.next() else {
        bail!("Invalid request: Missing method");
    };

    if method.is_empty() {
        bail!("Invalid request: Empty method");
    }

    let method = method.to_string();

    if !config.methods.contains(&method) {
        config.methods.push(method);
    }

    let Some(uri) = request_parts.next() else {
        bail!("Invalid request: Missing request line URI");
    };

    if uri.is_empty() {
        bail!("Invalid request: Empty request line URI");
    }

    for mut line in head_parts {
        line = line.trim_matches('\r').trim();

View on GitHub (pinned to 1f595dab5c)