{"record":{"id":"b52d2d7c35eb76e3","repo":"Hmbown/CodeWhale","slug":"failed-to-build-http-client-b52d2d","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/vision/tools.rs","lineNumber":39,"sourceCode":"    route_client: Option<DeepSeekClient>,\n}\n\nimpl ImageAnalyzeTool {\n    #[cfg(test)]\n    #[must_use]\n    pub fn new(config: VisionModelConfig) -> Self {\n        Self::new_with_route_client(config, None)\n    }\n\n    #[must_use]\n    pub fn new_with_route_client(\n        config: VisionModelConfig,\n        route_client: Option<DeepSeekClient>,\n    ) -> Self {\n        let client = crate::tls::reqwest_client_builder()\n            .timeout(Duration::from_secs(120))\n            .build()\n            .expect(\"Failed to build HTTP client\");\n        Self {\n            config,\n            client,\n            route_client,\n        }\n    }\n\n    async fn read_image_file(path: &Path) -> Result<(String, String), ToolError> {\n        let bytes = tokio::fs::read(path)\n            .await\n            .map_err(|e| ToolError::execution_failed(format!(\"Failed to read image file: {e}\")))?;\n\n        let mime_type = Self::detect_mime_type(path)?;\n        let base64_data = BASE64.encode(&bytes);\n        Ok((base64_data, mime_type))\n    }\n\n    fn resolve_image_path(workspace: &Path, image_path: &str) -> Result<PathBuf, ToolError> {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/vision/tools.rs#L21-L57","documentation":"ImageAnalyzeTool::new_with_route_client builds the shared reqwest HTTP client (120s timeout, crate TLS settings) in the constructor and expects success. A panic means the reqwest/TLS backend could not initialize — typically missing system CA material or a broken rustls/crypto provider — so the vision tool cannot function at all and fails fast at construction rather than per-request.","triggerScenarios":"Thrown at crates/tui/src/vision/tools.rs:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fall back to a client without the custom TLS builder if reqwest_client_builder fails, and surface image analysis errors per-request instead","Return Result<Self, Error> from the constructor so callers can degrade the tool gracefully","Check TLS/crypto provider setup (rustls feature flags, CA bundle env) when this fires"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}