epi052/feroxbuster · error

Empty header provided

Error message

Empty header provided

What it means

split_header parses an `Name: value` header string and rejects completely empty input. With no characters at all there is neither a header name nor a value, so the function throws immediately. This validates each `--header` argument or request-file header line at the entry point.

Solutions

  1. Remove the empty header argument from the CLI invocation or request file
  2. Ensure environment variables interpolated into header arguments are set and non-empty
  3. Filter empty strings out of any dynamically built header list before parsing

Example fix

// before
let headers: Vec<String> = raw_headers; // may contain ""
// after
let headers: Vec<String> = raw_headers.into_iter().filter(|h| !h.is_empty()).collect();
Defensive patterns

Strategy: validation

Validate before calling

let headers: Vec<&str> = raw.iter().map(|s| s.as_str()).filter(|h| !h.trim().is_empty()).collect();

Try / catch

match split_header(h) {
    Ok((name, value)) => insert_header(name, value),
    Err(e) => eprintln!("skipping invalid header '{h}': {e}"),
}

Prevention

When it happens

Trigger: Calling split_header("") directly; passing an empty string as a `-H/--header` CLI argument; a request-file header entry that expands to an empty string.

Common situations: Empty environment variables in headers (`-H "$AUTH_HEADER"` with the var unset), loop-generated header lists containing blanks, or malformed quoting producing an empty argument.

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/48f056fd6269608a. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:307

/// malformed (e.g., empty or missing a key), it returns an error.
///
/// # Arguments
///
/// * `header` - A string slice that holds the header string to be split.
///
/// # Returns
///
/// * `Result<(String, String)>` - A tuple containing the key and value as `String`s,
///   or an error if the input is invalid.
///
/// # Errors
///
/// This function will return an error if:
/// * The input string is empty.
/// * The key part of the header string is empty (i.e., if the string starts with `":"`).
pub fn split_header(header: &str) -> Result<(String, String)> {
    if header.is_empty() {
        bail!("Empty header provided");
    }

    let mut split_val = header.split(':');

    // explicitly take first split value as header's name
    let name = split_val.next().unwrap().trim().to_string();

    if name.is_empty() {
        bail!("Empty header name provided");
    }

    // all other items in the iterator returned by split, when combined with the
    // original split deliminator (:), make up the header's final value
    let value = split_val.collect::<Vec<&str>>().join(":");

    if value.starts_with(' ') && !value.starts_with("  ") {
        // first character is a space and the second character isn't
        // we can trim the leading space

View on GitHub (pinned to 1f595dab5c)