{"record":{"id":"976f16291e4ce35e","repo":"epi052/feroxbuster","slug":"empty-key-in-query-string","errorCode":null,"errorMessage":"Empty key in query string","messagePattern":"Empty key in query string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/utils.rs","lineNumber":277,"sourceCode":"/// * `Result<(String, String)>` - A tuple containing the key and value as `String`s,\n///   or an error if the input is invalid.\n///\n/// # Errors\n///\n/// This function will return an error if:\n/// * The input string is empty or equal to `\"=\"`.\n/// * The key part of the query string is empty (i.e., if the string starts with `\"=\"`).\npub fn split_query(query: &str) -> Result<(String, String)> {\n    if query.is_empty() || query == \"=\" {\n        bail!(\"Empty query string provided\");\n    }\n\n    let mut split_val = query.split('=');\n\n    let name = split_val.next().unwrap().trim();\n\n    if name.is_empty() {\n        bail!(\"Empty key in query string\");\n    }\n\n    let value = split_val.collect::<Vec<&str>>().join(\"=\");\n\n    Ok((name.to_string(), value.to_string()))\n}\n\n/// Splits an HTTP header string into a key-value pair.\n///\n/// This function takes a header string in the format of `\"Key: Value\"` and splits it into\n/// a tuple containing the key and value as separate strings. If the header string is\n/// malformed (e.g., empty or missing a key), it returns an error.\n///\n/// # Arguments\n///\n/// * `header` - A string slice that holds the header string to be split.\n///\n/// # Returns","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/config/utils.rs#L259-L295","documentation":"split_query splits a query string on `=` and requires a non-empty key before the first `=`. If the input starts with `=` (or the part before `=` is only whitespace after trimming), there is no parameter name to return, so it throws. This keeps CLI `--query` entries well-formed.","triggerScenarios":"Calling split_query(\"=value\") or split_query(\"=\") with surrounding whitespace like split_query(\" =value\") — the key is empty after trim.","commonSituations":"Typos in CLI flags (`--query =foo` from a misplaced space), templated request files where a variable name was dropped (`={{value}}` collapsing to `=value`), or copy-paste errors losing the parameter name.","solutions":["Add the missing key name before the `=` (e.g. `foo=bar` instead of `=bar`)","Check the request file / CLI args for stray leading `=` characters and remove or fix them","Validate each query entry matches `key=value` format before passing it to the parser"],"exampleFix":"// before\nxatu --query \"=123\"\n// after\nxatu --query \"block=123\"","handlingStrategy":"validation","validationCode":"if !q.is_empty() && q != \"=\" && !q.starts_with('=') { /* safe to parse */ }","typeGuard":null,"tryCatchPattern":"match split_query(entry) {\n    Ok((k, v)) => insert_query(k, v),\n    Err(e) => eprintln!(\"invalid query entry '{entry}': {e}\"),\n}","preventionTips":["Always write query parameters as key=value with a non-empty key","Check templated request files for variables that expand to empty names","Validate entries against a `^[^=\\s][^=]*=.+$`-style pattern before parsing"],"tags":["cli","query-string","validation","rust"],"backgroundTag":"empty-required-field","analyzedSha":"1f595dab5c76858d5a14fbc47dabf2563d729c62","analyzedAt":"2026-09-13T19:33:06.208Z","contentChangedAt":"2026-09-13T19:33:06.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}