epi052/feroxbuster · error

Invalid request: Empty request line

Error message

Invalid request: Empty request line

What it means

parse_request_file takes the first line of the request head as the request line and requires it to be non-empty. An empty first line means the file starts with a blank line instead of a `METHOD /path HTTP/x.x` request line, so parsing cannot proceed and the function throws. It catches files whose request line was lost or replaced by a newline.

Solutions

  1. Delete the leading blank line so the file starts with the request line (`GET / HTTP/1.1`)
  2. Re-copy the raw request ensuring no whitespace precedes the method
  3. Trim leading newlines from the request file before running

Example fix

// before (request.txt)
\nGET / HTTP/1.1
Host: example.com

// after
GET / HTTP/1.1
Host: example.com

Defensive patterns

Strategy: validation

Validate before calling

let text = std::fs::read_to_string(&path)?;
if text.starts_with(['\n', '\r']) { return Err(anyhow!("request file must not start with a blank line")); }

Try / catch

match parse_request_file(&mut config) {
    Ok(()) => {},
    Err(e) => eprintln!("bad --request-file: {e}; remove leading blank lines"),
}

Prevention

When it happens

Trigger: A `--request-file` that begins with a blank line (e.g. leading `\n` or `\r\n` before the actual request), leaving an empty request line after the head is split on `\n`.

Common situations: Copy-paste operations that insert a leading newline, editors adding a blank first line, or log excerpts that include a preceding empty line before the request.

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/9070f32d86cf2a7b. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:486

    // normalize line endings in the decoded head
    let normalized = head.replace("\r\n", "\n");

    // we only want to use the request's body bytes if the user hasn't
    // overridden it on the cli
    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);
    }

View on GitHub (pinned to 1f595dab5c)