{"record":{"id":"66942b892b299ebc","repo":"ducaale/xh","slug":"this-binary-was-built-without-native-tls-support","errorCode":null,"errorMessage":"This binary was built without native-tls support","messagePattern":"This binary was built without native-tls support","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":188,"sourceCode":"            client = client.use_native_tls();\n        }\n\n        #[cfg(not(feature = \"native-tls\"))]\n        if tls_version < tls::Version::TLS_1_2 {\n            log::warn!(\n                \"rustls does not support older TLS versions. Consider building with the `native-tls` feature enabled.\"\n            );\n        }\n    }\n\n    #[cfg(feature = \"native-tls\")]\n    if args.native_tls {\n        client = client.use_native_tls();\n    }\n\n    #[cfg(not(feature = \"native-tls\"))]\n    if args.native_tls {\n        return Err(anyhow!(\"This binary was built without native-tls support\"));\n    }\n\n    let mut failure_code = None;\n    let mut resume: Option<u64> = None;\n    let mut auth = None;\n    let mut save_auth_in_session = true;\n\n    let verify = args.verify.unwrap_or_else(|| {\n        // requests library which is used by HTTPie checks for both\n        // REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE environment variables.\n        // See https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification\n        if let Some(path) = env::var_os(\"REQUESTS_CA_BUNDLE\") {\n            Verify::CustomCaBundle(PathBuf::from(path))\n        } else if let Some(path) = env::var_os(\"CURL_CA_BUNDLE\") {\n            Verify::CustomCaBundle(PathBuf::from(path))\n        } else {\n            Verify::Yes\n        }","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/ducaale/xh/blob/2404aceecc08b0b2d100fedc96f57745cd5904dc/src/main.rs#L170-L206","documentation":"The user passed the --native-tls flag, but the binary was compiled without the `native-tls` cargo feature, so there is no native TLS backend to switch to. The CLI rejects the flag at runtime rather than silently ignoring it.","triggerScenarios":"run() sees args.native_tls == true while the crate was built with #[cfg(not(feature = \"native-tls\"))].","commonSituations":"Using a distro-packaged or prebuilt binary compiled only with rustls and passing --native-tls; container images with slim builds; organizational mirror binaries built with default features only.","solutions":["Remove the --native-tls flag and use the default TLS backend (rustls).","Install/rebuild a binary with the native-tls feature: cargo build --features native-tls.","Set required system TLS dependencies (e.g. OpenSSL dev packages) when rebuilding with native-tls.","Download the official full-featured release binary instead of a minimal build."],"exampleFix":"// before\nxh --native-tls GET example.org\n// after\ncargo install xh --features native-tls\nxh --native-tls GET example.org  # or omit the flag","handlingStrategy":"fallback","validationCode":"// shell guard before invoking\nif [ -n \"$NATIVE_TLS_FLAG\" ] && ! xh --version >/dev/null 2>&1; then :; fi\n// or in code: skip the flag unless the build advertises native-tls\nlet use_native = args.native_tls && cfg!(feature = \"native-tls\");","typeGuard":null,"tryCatchPattern":"match run(args) {\n    Err(e) if e.to_string().contains(\"without native-tls\") => {\n        args.native_tls = false; // retry with default TLS backend\n        run(args)\n    }\n    other => other,\n}","preventionTips":["Only pass --native-tls on builds you know include the feature.","Document the feature set of the binary your team distributes.","Prefer the default rustls backend unless corporate TLS interception requires native certs.","Check `--version`/build metadata for enabled features before scripting flags."],"tags":["tls","cli","feature-flag","build"],"backgroundTag":"feature-not-enabled","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"}