{"record":{"id":"002cdf2d3e31457d","repo":"ducaale/xh","slug":"unknown-option-key","errorCode":null,"errorMessage":"Unknown option '{key}'","messagePattern":"Unknown option '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli.rs","lineNumber":1046,"sourceCode":"                    format_options.json_indent = Some(value.parse().with_context(value_error)?);\n                }\n                \"json.format\" => {\n                    format_options.json_format = Some(value.parse().with_context(value_error)?);\n                }\n                \"headers.sort\" => {\n                    format_options.headers_sort = Some(value.parse().with_context(value_error)?);\n                }\n                \"xml.indent\" => {\n                    format_options.xml_indent = Some(value.parse().with_context(value_error)?);\n                }\n                \"xml.format\" => {\n                    format_options.xml_format = Some(value.parse().with_context(value_error)?);\n                }\n                \"json.sort_keys\" => {\n                    return Err(anyhow!(\"Unsupported option '{key}'\"));\n                }\n                _ => {\n                    return Err(anyhow!(\"Unknown option '{key}'\"));\n                }\n            }\n        }\n        Ok(format_options)\n    }\n}\n\n#[derive(Default, ValueEnum, Debug, PartialEq, Eq, Clone, Copy)]\npub enum Theme {\n    #[default]\n    Auto,\n    Solarized,\n    Monokai,\n    Fruity,\n}\n\nimpl Theme {\n    pub fn as_str(&self) -> &'static str {","sourceCodeStart":1028,"sourceCodeEnd":1064,"githubUrl":"https://github.com/ducaale/xh/blob/2404aceecc08b0b2d100fedc96f57745cd5904dc/src/cli.rs#L1028-L1064","documentation":"The --format-options parser hit a key it does not recognize at all (not even as an explicitly unsupported one), producing 'Unknown option'. The parser whitelists known dotted keys like xml.indent, xml.format, etc.","triggerScenarios":"Passing --format-options=<unrecognized-key>=<value> with a key outside the parser's match arms.","commonSituations":"Typo in an option key (e.g. 'xml.indnt'); using options from a different tool version or another HTTP client; guessing option names.","solutions":["Check the supported --format-options keys for this version (e.g. json.format, json.indent, xml.format, xml.indent, headers.sort, etc.)","Fix typos in the option key","Consult --help or the README for the exact option names"],"exampleFix":"# before\nhttp --format-options=xml.indnt=4 GET example.org\n# after\nhttp --format-options=xml.indent=4 GET example.org","handlingStrategy":"validation","validationCode":"// validate keys against the whitelist before running\nconst KNOWN: &[&str] = &[\"json.format\",\"json.indent\",\"xml.format\",\"xml.indent\",\"headers.sort\",\"headers.warn\"];\nlet key = kv.split('=').next().unwrap();\nif !KNOWN.contains(&key) { eprintln!(\"unknown format option: {key}\"); }","typeGuard":null,"tryCatchPattern":"let out = Command::new(\"http\").args([&format!(\"--format-options={opt}\"), ...]).output()?;\nif !out.status.success() && String::from_utf8_lossy(&out.stderr).contains(\"Unknown option\") {\n    eprintln!(\"bad --format-options key in '{opt}'; see http --help\");\n}","preventionTips":["Run `http --help` to confirm exact option names before use","Watch for typos in dotted keys (xml.indent vs xml.indnt)","Avoid copying format options from other tools or versions","Keep a tested list of valid options in wrapper scripts"],"tags":["cli","format-options","unknown-option"],"backgroundTag":"invalid-cli-argument","analyzedSha":"2404aceecc08b0b2d100fedc96f57745cd5904dc","analyzedAt":"2026-09-13T19:13:33.814Z","contentChangedAt":"2026-09-13T19:13:33.814Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}