{"record":{"id":"a2a4c8de81939640","repo":"ducaale/xh","slug":"unsupported-option-key","errorCode":null,"errorMessage":"Unsupported option '{key}'","messagePattern":"Unsupported option '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli.rs","lineNumber":1043,"sourceCode":"\n            match key {\n                \"json.indent\" => {\n                    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}","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/ducaale/xh/blob/2404aceecc08b0b2d100fedc96f57745cd5904dc/src/cli.rs#L1025-L1061","documentation":"The --format-options parser explicitly rejects the key 'json.sort_keys' as unsupported, even though it follows the dotted key=value syntax. Any other unrecognized key yields the separate 'Unknown option' error.","triggerScenarios":"Passing --format-options=json.sort_keys=true (or any value) on the command line; the key is matched by an explicit arm that errors.","commonSituations":"Users assuming JSON output supports a sort_keys toggle similar to Python's json.dumps; copying format options from other HTTPie-like tools.","solutions":["Remove json.sort_keys from --format-options","Request the feature upstream or patch cli.rs to implement sorted JSON keys","Use a post-processing step (e.g. jq -S) to sort JSON output"],"exampleFix":"# before\nhttp --format-options=json.sort_keys=true GET example.org\n# after\nhttp GET example.org | jq -S .","handlingStrategy":"validation","validationCode":"// validate format options before invoking\nconst SUPPORTED: &[&str] = &[\"json.format\",\"json.indent\",\"xml.format\",\"xml.indent\",\"headers.sort\"];\nfor kv in opts.split(',') {\n    let key = kv.split('=').next().unwrap();\n    if key == \"json.sort_keys\" { eprintln!(\"json.sort_keys is unsupported; pipe through jq -S instead\"); }\n}","typeGuard":null,"tryCatchPattern":"let out = Command::new(\"http\").args([&\"--format-options=json.sort_keys=true\", ...]).output()?;\nif !out.status.success() && String::from_utf8_lossy(&out.stderr).contains(\"Unsupported option\") {\n    eprintln!(\"json.sort_keys unsupported; use: http ... | jq -S .\");\n}","preventionTips":["Don't pass json.sort_keys; sort JSON with jq -S or a post-processor","Check --help for supported format-options keys in your version","Pin tool version in scripts and validate option names against it"],"tags":["cli","format-options","json","unsupported"],"backgroundTag":"unsupported-operation","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"}