epi052/feroxbuster · error

Invalid request: Missing method

Error message

Invalid request: Missing method

What it means

parse_request_file splits the request line on whitespace and takes the first token as the HTTP method. If the line splits into no tokens (e.g. it contains only whitespace-like characters that survived earlier checks), there is no method and the function throws. A valid request line must begin with an HTTP method token.

Solutions

  1. Ensure the first line starts with a valid HTTP method (GET, POST, PUT, DELETE, etc.) followed by a space
  2. Re-copy or re-export the raw request to restore the intact request line
  3. Open the file in a hex/whitespace-visible editor to spot invisible characters replacing the method

Example fix

// before (request.txt first line)
\t\t
// after
GET / HTTP/1.1
Defensive patterns

Strategy: validation

Validate before calling

let text = std::fs::read_to_string(&path)?;
let first = text.lines().next().unwrap_or("");
if first.split_whitespace().next().is_none() {
    return Err(anyhow!("request line has no method token"));
}

Try / catch

match parse_request_file(&mut config) {
    Ok(()) => {},
    Err(e) => eprintln!("bad --request-file: {e}; first line must start with an HTTP method"),
}

Prevention

When it happens

Trigger: A `--request-file` whose first non-empty line contains no whitespace-delimited method token — practically, a line of only unusual whitespace characters that passed the empty-string check but yields no split parts.

Common situations: Corrupted or hand-mangled request files where the method text was replaced by stray whitespace/tab characters, or truncated files that kept only fragments of the request line.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src/config/utils.rs:492

    if config.data.is_empty() {
        config.data = body_bytes.to_vec();
    }

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

View on GitHub (pinned to 1f595dab5c)