epi052/feroxbuster · error

Empty query string provided

Error message

Empty query string provided

What it means

split_query parses a `key=value` query string into a tuple and rejects inputs that carry no key/value information at all. It throws when the input string is empty or is exactly `"="`, because no query parameter can be derived from it. This is an eager argument-validation guard at the entry of the function.

Solutions

  1. Remove the empty/`=`-only query argument from the CLI invocation or request file
  2. Ensure shell variables used in `-q "$VAR"` are set and non-empty before running
  3. Filter out empty query strings before collecting them into a list passed to the config parser

Example fix

// before
let queries: Vec<String> = raw_queries; // may contain ""
// after
let queries: Vec<String> = raw_queries.into_iter().filter(|q| !q.is_empty() && *q != "=").collect();
Defensive patterns

Strategy: validation

Validate before calling

let queries: Vec<&str> = raw.iter().map(|s| s.as_str()).filter(|q| !q.is_empty() && *q != "=").collect();

Try / catch

match split_query(q) {
    Ok((k, v)) => insert_query(k, v),
    Err(e) => eprintln!("skipping invalid query '{q}': {e}"),
}

Prevention

When it happens

Trigger: Calling split_query("") or split_query("=") directly; passing an empty or `=`-only `-q/--query` CLI argument; a request file containing an empty query line entry.

Common situations: Users quoting CLI args so an empty string reaches the parser (`-q ""`), shell variables that expand to nothing (`-q "$QUERY"` with QUERY unset), or scripts generating `=` placeholders for unfilled parameters.

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/5ce1f649e4e32a88. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:269

/// malformed (e.g., empty or without a key), it returns an error.
///
/// # Arguments
///
/// * `query` - A string slice that holds the query 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 or equal to `"="`.
/// * The key part of the query string is empty (i.e., if the string starts with `"="`).
pub fn split_query(query: &str) -> Result<(String, String)> {
    if query.is_empty() || query == "=" {
        bail!("Empty query string provided");
    }

    let mut split_val = query.split('=');

    let name = split_val.next().unwrap().trim();

    if name.is_empty() {
        bail!("Empty key in query string");
    }

    let value = split_val.collect::<Vec<&str>>().join("=");

    Ok((name.to_string(), value.to_string()))
}

/// Splits an HTTP header string into a key-value pair.
///
/// This function takes a header string in the format of `"Key: Value"` and splits it into

View on GitHub (pinned to 1f595dab5c)