{"record":{"id":"1030a6ee3814e2df","repo":"vectordotdev/vector","slug":"https-initialization-failed","errorCode":null,"errorMessage":"HTTPS initialization failed","messagePattern":"HTTPS initialization failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/sources/apache_metrics/mod.rs","lineNumber":158,"sourceCode":"        s\n    }\n}\n\nfn apache_metrics(\n    urls: Vec<http::Uri>,\n    interval: Duration,\n    namespace: Option<String>,\n    shutdown: ShutdownSignal,\n    mut out: SourceSender,\n    proxy: ProxyConfig,\n) -> super::Source {\n    Box::pin(async move {\n        let mut stream = IntervalStream::new(tokio::time::interval(interval))\n            .take_until(shutdown)\n            .map(move |_| stream::iter(urls.clone()))\n            .flatten()\n            .map(move |url| {\n                let client = HttpClient::new(None, &proxy).expect(\"HTTPS initialization failed\");\n                let sanitized_url = url.to_sanitized_string();\n\n                let request = Request::get(&url)\n                    .body(Body::empty())\n                    .expect(\"error creating request\");\n\n                let tags = metric_tags! {\n                    \"endpoint\" => sanitized_url.to_string(),\n                    \"host\" => url.sanitized_authority(),\n                };\n\n                let namespace = namespace.clone();\n                client\n                    .send(request)\n                    .map_err(crate::Error::from)\n                    .and_then(|response| async {\n                        let (header, body) = response.into_parts();\n                        let body = http_body::Body::collect(body).await?.to_bytes();","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sources/apache_metrics/mod.rs#L140-L176","documentation":"The apache_metrics source builds an HttpClient inside the streaming closure for every URL tick and unwraps with expect(\"HTTPS initialization failed\"). HttpClient::new returns an error when the TLS/HTTPS backend cannot initialize (e.g. OpenSSL/alpn-rustls setup failure, bad proxy configuration), and that panic aborts the source task.","triggerScenarios":"HttpClient::new(None, &proxy) failing — typically due to a misconfigured proxy setting or TLS backend initialization error — evaluated each time the interval stream emits a URL.","commonSituations":"Invalid proxy config in the source; container images missing CA certificates or TLS roots; environment (SSL_CERT_FILE/SSL_CERT_DIR) pointing at unreadable files.","solutions":["Correct the proxy configuration for the apache_metrics source (or remove it if not needed).","Ensure the system CA certificates are installed and SSL_CERT_FILE/SSL_CERT_DIR are valid.","Hoist HttpClient::new out of the closure to build once, and propagate the error in the source's build() instead of panicking per tick."],"exampleFix":"// before\nlet client = HttpClient::new(None, &proxy).expect(\"HTTPS initialization failed\");\n// after (in build())\nlet client = HttpClient::new(None, &proxy)?;","handlingStrategy":"fallback","validationCode":"// at source build time\nlet client = HttpClient::new(None, &proxy).map_err(|e| BuildError::from(e))?;","typeGuard":null,"tryCatchPattern":"HttpClient::new(None, &proxy).unwrap_or_else(|_| HttpClient::new(None, &None).expect(\"default client\"))","preventionTips":["Build the HttpClient once in build(), not per tick in the stream closure.","Install CA certificates in container images.","Verify proxy and SSL_CERT_* settings before deploying."],"tags":["rust","panic","tls","http","source"],"backgroundTag":"module-init-failed","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}