{"record":{"id":"9994120914e8eb08","repo":"BoundaryML/baml","slug":"failed-to-create-http-client-e","errorCode":null,"errorMessage":"Failed to create HTTP client: {e}","messagePattern":"Failed to create HTTP client: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/playground-server/src/server.rs","lineNumber":126,"sourceCode":"\n/// Downloads and extracts the playground frontend from the baml GitHub release.\n/// Uses the provided version for both asset name construction and release tag lookup.\n/// Returns the path to the directory containing the static files to serve (may be a nested 'dist' directory).\npub async fn get_playground_dist(github_repo: &str, version: &str) -> anyhow::Result<String> {\n    // Construct versioned asset names\n    let web_panel_asset_name = format!(\"playground-dist-{version}.tar.gz\");\n    let checksum_asset_name = format!(\"playground-dist-{version}.tar.gz.sha256\");\n\n    // Build the GitHub API URL using the version as the release tag\n    let api_url = format!(\"https://api.github.com/repos/{github_repo}/releases/tags/{version}\");\n    tracing::info!(\"Fetching web-panel release metadata from: {}\", api_url);\n\n    // Fetch release metadata with timeout\n    let client = reqwest::Client::builder()\n        .timeout(Duration::from_secs(30))\n        .connect_timeout(Duration::from_secs(10))\n        .build()\n        .map_err(|e| anyhow::anyhow!(\"Failed to create HTTP client: {e}\"))?;\n\n    tracing::info!(\"Sending request to GitHub API...\");\n    let resp = client\n        .get(&api_url)\n        .header(\"User-Agent\", \"baml-playground-server\")\n        .send()\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to fetch release metadata: {e}\"))?;\n\n    tracing::info!(\"Received response with status: {}\", resp.status());\n\n    // Check if the response is successful\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp\n            .text()\n            .await\n            .unwrap_or_else(|_| \"Failed to read response body\".to_string());","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/playground-server/src/server.rs#L108-L144","documentation":"In get_playground_dist, the server builds a reqwest HTTP client (with 30s request / 10s connect timeouts) to query the GitHub API for a playground release. If reqwest cannot construct the client (TLS backend initialization failure, resolver errors, invalid settings), the error is wrapped with this message. It happens before any network request is sent.","triggerScenarios":"reqwest::Client::builder().build() returns Err inside get_playground_dist, e.g. because the TLS backend failed to initialize or the system resolver/config is broken.","commonSituations":"Deploying in a minimal container without CA certificates, breaking rustls/native-tls initialization; corrupted or incompatible OpenSSL on the host; a build with conflicting TLS feature flags.","solutions":["Ensure the runtime image includes system CA certificates (e.g. install ca-certificates in the Docker image).","Check that the TLS backend dependencies (rustls or native-tls/OpenSSL) are correctly built for the target platform.","Rebuild with a known-good TLS feature configuration for reqwest (e.g. default-tls vs rustls-tls, not conflicting both)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// fall back to bundled dist if client cannot be built\nmatch get_playground_dist().await {\n    Err(e) if e.to_string().contains(\"Failed to create HTTP client\") => {\n        use_bundled_playground_dist();\n    }\n    other => other?,\n}","preventionTips":["Install ca-certificates in runtime Docker images","Test TLS client construction in a smoke test on the target image","Keep reqwest TLS feature flags consistent","Prefer rustls-tls to avoid system OpenSSL issues"],"tags":["network","http-client","rust","tls"],"backgroundTag":"module-init-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}