epi052/feroxbuster · error

Empty --request-file file provided

Error message

Empty --request-file file provided

What it means

parse_request_file reads the file named by `config.request_file` and parses it as a raw HTTP request. If the file exists but contains zero bytes, no request can be parsed, so it throws this error. This catches the case of a valid path pointing at an empty file.

Solutions

  1. Fill the request file with a valid raw HTTP request (request line, headers, blank line, optional body)
  2. Re-export or re-download the request file if it was truncated
  3. Check the file size (`ls -l`) before running and confirm it is non-empty

Example fix

// before (empty file)
touch request.txt
// after
printf 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n' > request.txt
Defensive patterns

Strategy: validation

Validate before calling

let meta = std::fs::metadata(&path)?;
if meta.len() == 0 { return Err(anyhow!("request file {path:?} is empty")); }

Try / catch

match std::fs::read(&path) {
    Ok(bytes) if !bytes.is_empty() => parse_request(bytes),
    Ok(_) => eprintln!("request file is empty"),
    Err(e) => eprintln!("cannot read request file: {e}"),
}

Prevention

When it happens

Trigger: Running with `--request-file <path>` where the file exists but is 0 bytes; creating a placeholder file with `touch` and forgetting to fill it.

Common situations: `touch req.txt` placeholders, editors/tools that truncated the file, failed downloads or redirect outputs (`curl -o`) that wrote nothing, or scripts creating the file but erroring before writing content.

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/4a2b4a062c6445a0. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:437

/// # Details
///
/// * The request body is only set if it hasn't been overridden by the CLI options.
/// * The request line method is added to `config.methods` if it's not already present.
/// * Headers from the raw request are added to `config.headers`, unless overridden
///   by CLI options. Special handling is applied to `User-Agent`, `Content-Length`,
///   and `Cookie` headers.
/// * The request URI is validated and parsed. If it's not a full URL, it will be
///   combined with the `Host` header to form a full target URL.
/// * Query parameters are extracted from the URI and added to `config.queries`,
///   unless overridden by CLI options.
///
pub fn parse_request_file(config: &mut Configuration) -> Result<()> {
    // read in the file (raw bytes) located at config.request_file
    // parse the file into a Request struct
    let contents = std::fs::read(&config.request_file)?;

    if contents.is_empty() {
        bail!("Empty --request-file file provided");
    }

    // find the first header/body separator
    // locate both \r\n\r\n and \n\n and pick whichever appears earliest,
    // so that a \r\n\r\n inside the body doesn't shadow a \n\n separator
    // that terminates the headers
    let crlf = contents.windows(4).position(|w| w == b"\r\n\r\n");
    let lf = contents.windows(2).position(|w| w == b"\n\n");

    let (sep_idx, sep_len) = match (crlf, lf) {
        (Some(c), Some(l)) => {
            if c <= l {
                (c, 4)
            } else {
                (l, 2)
            }
        }
        (Some(c), None) => (c, 4),

View on GitHub (pinned to 1f595dab5c)