{"record":{"id":"f50bd2c57486de9c","repo":"Hmbown/CodeWhale","slug":"failed-to-build-http-client","errorCode":null,"errorMessage":"failed to build HTTP client","messagePattern":"failed to build HTTP client","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/finance.rs","lineNumber":159,"sourceCode":"    fn summary(&self) -> String {\n        format!(\"{}: {}\", self.endpoint, self.detail)\n    }\n}\n\npub struct FinanceTool {\n    endpoints: FinanceEndpoints,\n    client: Client,\n}\n\nimpl FinanceTool {\n    #[must_use]\n    pub fn new() -> Self {\n        Self {\n            endpoints: FinanceEndpoints::default(),\n            client: crate::tls::reqwest_client_builder()\n                .user_agent(USER_AGENT)\n                .build()\n                .expect(\"failed to build HTTP client\"),\n        }\n    }\n\n    #[cfg(test)]\n    fn with_endpoints(quote_base: impl Into<String>, chart_base: impl Into<String>) -> Self {\n        Self {\n            endpoints: FinanceEndpoints {\n                quote_base: quote_base.into(),\n                chart_base: chart_base.into(),\n            },\n            client: crate::tls::reqwest_client_builder()\n                .user_agent(USER_AGENT)\n                .build()\n                .expect(\"failed to build HTTP client\"),\n        }\n    }\n}\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/finance.rs#L141-L177","documentation":"Panic constructing the finance tool's HTTP client: `crate::tls::reqwest_client_builder()` with a user agent fails at `.build()`. Same family as the skills installer's client-build panic: TLS backend initialization failure (bad `SSL_CERT_FILE`/`SSL_CERT_DIR`, unreadable CA store, broken OpenSSL) or conflicting builder settings. `FinanceTool::new()` runs when the tool is registered, so the panic can abort turn/tool setup rather than just one web call.","triggerScenarios":"A machine whose TLS trust environment is broken (env vars pointing at missing files, empty `/etc/ssl/certs`); the first turn that instantiates the finance tool panics inside `new()`.","commonSituations":"Hardened shells and Nix/direnv setups leaking `SSL_*` vars; minimal CI/dev containers without `ca-certificates`; hosts behind TLS-intercepting proxies with roots outside the default store.","solutions":["Check `env | grep -iE 'ssl|proxy'`; make `SSL_CERT_FILE`/`SSL_CERT_DIR` point at existing readable bundles or unset them.","Reinstall the system CA package and retry.","Verify with `RUST_BACKTRACE=1` that the failure is in the client builder, then report the platform TLS configuration.","For embedders: build the client lazily per call and surface `reqwest::Error` instead of panicking in `new()`."],"exampleFix":"// before\nclient: crate::tls::reqwest_client_builder()\n    .user_agent(USER_AGENT)\n    .build()\n    .expect(\"failed to build HTTP client\")\n\n// after: log the TLS misconfiguration and fall back to a default client\nlet client = crate::tls::reqwest_client_builder()\n    .user_agent(USER_AGENT)\n    .build()\n    .unwrap_or_else(|err| {\n        tracing::warn!(\"custom TLS client build failed: {err}; using default client\");\n        reqwest::Client::new()\n    });","handlingStrategy":"validation","validationCode":"// Verify the TLS trust environment before registering the finance tool\nfor var in [\"SSL_CERT_FILE\", \"SSL_CERT_DIR\"] {\n    if let Ok(v) = std::env::var(var) {\n        assert!(std::path::Path::new(&v).exists(), \"{var}={v} does not exist\");\n    }\n}","typeGuard":null,"tryCatchPattern":"let client = std::panic::catch_unwind(|| {\n    crate::tls::reqwest_client_builder().user_agent(USER_AGENT).build()\n})\n.map(std::result::Result::unwrap)\n.unwrap_or_else(|_| reqwest::Client::new());","preventionTips":["Install/refresh the system CA bundle on hosts running the finance tool.","Do not export SSL_CERT_FILE/SSL_CERT_DIR without pointing them at real bundles.","Build network clients lazily so a broken TLS env degrades one call, not tool registration."],"tags":["rust","reqwest","tls","ca-certificate","finance-tool","panic","expect"],"backgroundTag":"http-client-build-failed","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}