{"record":{"id":"d4b85bbf20b1d9ad","repo":"Zackriya-Solutions/meetily","slug":"failed-to-create-download-client","errorCode":null,"errorMessage":"Failed to create download client: {}","messagePattern":"Failed to create download client: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/whisper_engine/whisper_engine.rs","lineNumber":1146,"sourceCode":"        }\n\n        if !self.models_dir.exists() {\n            fs::create_dir_all(&self.models_dir)\n                .await\n                .map_err(|e| anyhow!(\"Failed to create models directory: {}\", e))?;\n        }\n\n        {\n            let mut models = self.available_models.write().await;\n            if let Some(model_info) = models.get_mut(model_name) {\n                model_info.status = ModelStatus::Downloading { progress: 0 };\n            }\n        }\n\n        let client = Client::builder()\n            .user_agent(concat!(\"Meetily/\", env!(\"CARGO_PKG_VERSION\")))\n            .build()\n            .map_err(|e| anyhow!(\"Failed to create download client: {}\", e))?;\n        let response = tokio::select! {\n            biased;\n            _ = active_download.cancellation.cancelled() => return Err(DownloadCancelled.into()),\n            response = client.get(model_url).send() => response\n                .map_err(|e| anyhow!(\"Failed to start download: {}\", e))?,\n        };\n\n        if !response.status().is_success() {\n            return Err(anyhow!(\"Download failed with status: {}\", response.status()));\n        }\n\n        let total_size = response.content_length().unwrap_or(0);\n        let mut file = fs::File::create(file_path)\n            .await\n            .map_err(|e| anyhow!(\"Failed to create file: {}\", e))?;\n\n        use futures_util::StreamExt;\n        let mut stream = response.bytes_stream();","sourceCodeStart":1128,"sourceCodeEnd":1164,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/whisper_engine/whisper_engine.rs#L1128-L1164","documentation":"download_model_with_owner builds an HTTP client via reqwest's Client::builder() (with a Meetily/... user agent) before fetching the model. If reqwest fails to construct the client — almost always TLS backend initialization failure (e.g. rustls or native-tls/openssl can't initialize, missing root store, or invalid default TLS configuration) — the builder's error is wrapped in this anyhow message and the download aborts before any network request.","triggerScenarios":"Client::builder().user_agent(...).build() returns Err: TLS backend init failure (openssl not linked, rustls without a crypto provider installed when multiple ring/aws-lc-rs versions are linked), invalid global default settings, or resource exhaustion during client construction.","commonSituations":"Building on Linux without OpenSSL dev headers when the native-tls feature is enabled; a dependency bump links two rustls crypto providers so no default is installed (rustls 0.23 'no process-level CryptoProvider' panic/error); stripped-down container/distro missing CA certificates that the TLS layer requires at init.","solutions":["Check the wrapped error text after the colon — it names the real cause (TLS/crypto provider, OpenSSL, etc.) and fix that first.","If using rustls 0.23 with multiple crypto providers, install one explicitly at startup: rustls::crypto::ring::default_provider().install_default().","On Linux, install OpenSSL development packages (libssl-dev) or switch Cargo features to the rustls TLS backend.","Ensure CA certificates exist in the environment (ca-certificates package on Alpine/slim containers).","Align reqwest features in Cargo.toml with the intended TLS backend and rebuild cleanly (cargo clean) to remove stale linking."],"exampleFix":"// before: relies on default crypto provider, fails when 2 are linked\nlet client = Client::builder()\n    .user_agent(concat!(\"Meetily/\", env!(\"CARGO_PKG_VERSION\")))\n    .build()\n    .map_err(|e| anyhow!(\"Failed to create download client: {}\", e))?;\n// after: install a concrete rustls provider before building any client\nrustls::crypto::ring::default_provider()\n    .install_default()\n    .expect(\"failed to install rustls crypto provider\");\nlet client = Client::builder()\n    .user_agent(concat!(\"Meetily/\", env!(\"CARGO_PKG_VERSION\")))\n    .build()\n    .map_err(|e| anyhow!(\"Failed to create download client: {}\", e))?;","handlingStrategy":"try-catch","validationCode":"// at app startup, fail fast if the TLS stack can't init\nfn http_stack_ok() -> bool {\n    reqwest::Client::builder().build().is_ok()\n}\nif !http_stack_ok() {\n    eprintln!(\"HTTP/TLS stack unavailable; model downloads disabled\");\n}","typeGuard":null,"tryCatchPattern":"let client = reqwest::Client::builder()\n    .user_agent(concat!(\"Meetily/\", env!(\"CARGO_PKG_VERSION\")))\n    .build()\n    .map_err(|e| {\n        eprintln!(\"client build failed: {e}\"); // surface TLS root cause\n        anyhow!(\"Failed to create download client: {}\", e)\n    })?;","preventionTips":["Install an explicit rustls crypto provider at startup if using rustls 0.23 with ring and aws-lc-rs both in the tree.","Keep reqwest's TLS feature flags consistent (avoid mixing native-tls and rustls features).","On Linux build/packaging machines, ensure libssl-dev and ca-certificates are installed.","Add a startup smoke test that builds a Client and performs a HEAD request to huggingface.co."],"tags":["network","tls","reqwest","rust","model-download"],"backgroundTag":"http-request-failed","analyzedSha":"a2cb62e827da7ef59f65064c97233efb2313878e","analyzedAt":"2026-09-12T11:12:14.152Z","contentChangedAt":"2026-09-12T11:12:14.152Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}