{"record":{"id":"25d297f44b06e409","repo":"vectordotdev/vector","slug":"building-http-client-failed","errorCode":null,"errorMessage":"Building HTTP client failed","messagePattern":"Building HTTP client failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/sources/util/http_client.rs","lineNumber":162,"sourceCode":"}\n\n/// Calls one or more urls at an interval.\n///   - The HTTP request is built per the options in provided generic inputs.\n///   - The HTTP response is decoded/parsed into events by the specific context.\n///   - The events are then sent to the output stream.\npub(crate) async fn call<\n    B: HttpClientBuilder<Context = C> + Send + Clone,\n    C: HttpClientContext + Send,\n>(\n    inputs: GenericHttpClientInputs,\n    context_builder: B,\n    mut out: SourceSender,\n    http_method: HttpMethod,\n) -> Result<(), ()> {\n    // Building the HttpClient should not fail as it is just setting up the client with the\n    // proxy and tls settings.\n    let client =\n        HttpClient::new(inputs.tls.clone(), &inputs.proxy).expect(\"Building HTTP client failed\");\n    let mut stream = IntervalStream::new(tokio::time::interval(inputs.interval))\n        .take_until(inputs.shutdown)\n        .map(move |_| stream::iter(inputs.urls.clone()))\n        .flatten()\n        .map(move |base_url| {\n            let client = client.clone();\n            let endpoint = base_url.to_string();\n\n            let context_builder = context_builder.clone();\n            let mut context = context_builder.build(&base_url);\n\n            // Check if we need to process the URL dynamically (for updating VRL expressions)\n            let url = context.process_url(&base_url).unwrap_or(base_url);\n\n            let mut builder = match http_method {\n                HttpMethod::Head => Request::head(&url),\n                HttpMethod::Get => Request::get(&url),\n                HttpMethod::Post => Request::post(&url),","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sources/util/http_client.rs#L144-L180","documentation":"The http_client-based source (e.g. http_endpoint/http poller) calls HttpClient::new with the configured TLS and proxy settings and .expect()s success, since setup normally cannot fail. A panic with \"Building HTTP client failed\" means the TLS/proxy configuration produced an unrecoverable client construction error, terminating the source at startup.","triggerScenarios":"Invalid or unloadable TLS configuration (bad certificate/key files, unsupported settings) or a broken proxy configuration passed via HttpClient::new in the source's build fn, causing the expect to fire when the source task starts.","commonSituations":"Typo'd certificate/key paths in the source's tls options, malformed PEM content, incompatible TLS settings (e.g. bad CA bundle), proxy settings referencing unresolvable or malformed URLs.","solutions":["Verify all TLS file paths (crt, key, ca) exist and contain valid PEM data","Check the source's proxy configuration for malformed URLs","Test with TLS options removed to isolate which setting breaks client construction","Regenerate or re-export certificates if the key material is corrupt or mismatched"],"exampleFix":"// before (vector.yaml)\ntls:\n  ca_file: /etc/ssl/missing-ca.pem\n// after\ntls:\n  ca_file: /etc/ssl/certs/ca-certificates.crt","handlingStrategy":"validation","validationCode":"test -f \"$CA_FILE\" && openssl x509 -in \"$CA_FILE\" -noout >/dev/null && echo ok || echo 'bad TLS config'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify TLS cert/key/CA paths and PEM validity before deploying","Smoke-test proxy URLs for format and reachability","Start sources with minimal TLS settings, then add options incrementally"],"tags":["rust","panic","tls","http-client"],"backgroundTag":"invalid-config-value","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"}