{"record":{"id":"9e1b64ba11304078","repo":"hatoo/oha","slug":"unknown-http-version-valid-versions-are-0-9-1-0","errorCode":null,"errorMessage":"Unknown HTTP version. Valid versions are 0.9, 1.0, 1.1, 2, 3","messagePattern":"Unknown HTTP version\\. Valid versions are 0\\.9, 1\\.0, 1\\.1, 2, 3","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":386,"sourceCode":"    } else {\n        None\n    };\n\n    let parse_http_version = |is_http2: bool, version: Option<&str>| match (is_http2, version) {\n        (true, Some(_)) => anyhow::bail!(\"--http2 and --http-version are exclusive\"),\n        (true, None) => Ok(http::Version::HTTP_2),\n        (false, Some(http_version)) => match http_version.trim() {\n            \"0.9\" => Ok(http::Version::HTTP_09),\n            \"1.0\" => Ok(http::Version::HTTP_10),\n            \"1.1\" => Ok(http::Version::HTTP_11),\n            \"2.0\" | \"2\" => Ok(http::Version::HTTP_2),\n            #[cfg(feature = \"http3\")]\n            \"3.0\" | \"3\" => Ok(http::Version::HTTP_3),\n            #[cfg(not(feature = \"http3\"))]\n            \"3.0\" | \"3\" => anyhow::bail!(\n                \"Your Oha instance has not been built with HTTP/3 support. Try recompiling with the feature enabled.\"\n            ),\n            _ => anyhow::bail!(\"Unknown HTTP version. Valid versions are 0.9, 1.0, 1.1, 2, 3\"),\n        },\n        (false, None) => Ok(http::Version::HTTP_11),\n    };\n\n    let http_version: http::Version = parse_http_version(opts.http2, opts.http_version.as_deref())?;\n    let proxy_http_version: http::Version =\n        parse_http_version(opts.proxy_http2, opts.proxy_http_version.as_deref())?;\n\n    let url_generator = if opts.rand_regex_url {\n        // Almost URL has dot in domain, so disable dot in regex for convenience.\n        let dot_disabled: String = url\n            .chars()\n            .map(|c| {\n                if c == '.' {\n                    regex_syntax::escape(\".\")\n                } else {\n                    c.to_string()\n                }","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/hatoo/oha/blob/4efba2d113d165aaaf7533f5d2893e7cc57ebfc1/src/main.rs#L368-L404","documentation":"The --http-version option only accepts 0.9, 1.0, 1.1, 2/2.0, and 3/3.0. Any other string falls through the match to a catch-all bail listing the valid versions. This validates user CLI input before any network activity.","triggerScenarios":"Passing an unrecognized version string such as `--http-version 1.2`, `--http-version http/1.1`, or a misspelled value like `--http-version 1,1`.","commonSituations":"Users typing versions with an 'HTTP/' prefix, using decimals like '1.2' that do not exist, or passing locale-formatted numbers.","solutions":["Use one of: 0.9, 1.0, 1.1, 2 (or 2.0), 3 (or 3.0).","Note bare `2` and `3` are accepted alternatives to `2.0`/`3.0`.","Check `oha --help` for the exact accepted values."],"exampleFix":"// before\noha --http-version 1.2 https://example.com\n// after\noha --http-version 1.1 https://example.com","handlingStrategy":"validation","validationCode":"const VALID: [&str; 6] = [\"0.9\", \"1.0\", \"1.1\", \"2\", \"2.0\", \"3\"];\nfn valid_http_version(v: &str) -> bool {\n    VALID.contains(&v) || v == \"3.0\"\n}","typeGuard":null,"tryCatchPattern":"match run(opts).await {\n    Err(e) if e.to_string().contains(\"Unknown HTTP version\") => {\n        eprintln!(\"Valid: 0.9, 1.0, 1.1, 2, 3\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Use bare `2` or `3` rather than decimals not in the accepted list.","Strip any 'HTTP/' prefix from user-supplied versions before mapping.","Validate user input against oha --help before invoking."],"tags":["cli","http-version","invalid-value"],"backgroundTag":"invalid-cli-argument","analyzedSha":"4efba2d113d165aaaf7533f5d2893e7cc57ebfc1","analyzedAt":"2026-09-09T16:24:23.306Z","contentChangedAt":"2026-09-09T16:24:23.306Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}