{"record":{"id":"b9ad69e2740bfc7a","repo":"BoundaryML/baml","slug":"exposederror-clienthttperror-client-name-message-status-code","errorCode":null,"errorMessage":"ExposedError::ClientHttpError { client_name, message, status_code, detailed_message, raw_response }","messagePattern":"ExposedError::ClientHttpError (.+?)","errorType":"exception","errorClass":"ExposedError","httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/types/response.rs","lineNumber":138,"sourceCode":"                Ok(val) => Ok(val),\n                Err(err) => Err(anyhow::anyhow!(self.format_last_error_with_details(err))),\n            })\n        else {\n            // If we don't have a parsed result, check if we have an LLMFailure\n            return match self.llm_response() {\n                    LLMResponse::LLMFailure(err) => {\n                        // Convert LLMFailure to appropriate error type\n                        match &err.code {\n                            crate::internal::llm_client::ErrorCode::Timeout => {\n                                Err(anyhow::anyhow!(crate::errors::ExposedError::TimeoutError {\n                                    client_name: err.client.clone(),\n                                    message: err.message.clone(),\n                                }))\n                            }\n                            crate::internal::llm_client::ErrorCode::Other(2) => {\n                                Err(anyhow::anyhow!(err.message.clone()))\n                            }\n                            _ => Err(anyhow::anyhow!(\n                                crate::errors::ExposedError::ClientHttpError {\n                                    client_name: err.client.clone(),\n                                    message: err.message.clone(),\n                                    status_code: err.code.clone(),\n                                    detailed_message: err.message.clone(),\n                                    raw_response: err.raw_response.clone(),\n                                }\n                            )),\n                        }\n                    }\n                    LLMResponse::UserFailure(message) => {\n                        Err(anyhow::anyhow!(\"User Failure: {message}.\\nPlease report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience.\"))\n                    }\n                    LLMResponse::InternalFailure(message) => {\n                        Err(anyhow::anyhow!(\"Internal Failure: {message}.\\nThis should not happen - please report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience.\"))\n                    }\n                    LLMResponse::Cancelled(message) => {\n                        Err(anyhow::anyhow!(crate::errors::ExposedError::AbortError {","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/types/response.rs#L120-L156","documentation":"For any other LLMFailure error code, result_with_constraints_content converts it to ExposedError::ClientHttpError with the client name, message, status code, detailed message and raw response. This is the generic HTTP-level failure path from the LLM provider.","triggerScenarios":"Reading the result of a chain whose LLM call failed with a non-timeout, non-Other(2) error code — typically HTTP error statuses (401, 403, 429, 5xx) returned by the provider.","commonSituations":"Invalid or expired API keys (401), quota/rate limits (429), provider 5xx outages, wrong base URL or model name (404).","solutions":["Inspect status_code and raw_response in the error to identify the provider issue.","Fix credentials/API key configuration for 401/403 errors.","Add retry with backoff for 429/5xx, or configure BAML's retry strategy.","Verify model name and provider base_url in the client config."],"exampleFix":"// before\nlet v = chain.content()?; // ClientHttpError 429 surfaces\n\n// after\nmatch chain.content() {\n    Ok(v) => Ok(v),\n    Err(e) if e.to_string().contains(\"429\") => retry_with_backoff(),\n    Err(e) => Err(e),\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match chain.content() {\n    Ok(v) => Ok(v),\n    Err(e) if is_http_status(&e, &[429, 500, 502, 503]) => retry_with_backoff(),\n    Err(e) => Err(e),\n}","preventionTips":["Verify API keys and base URLs before deploying","Use retry with exponential backoff for 429/5xx","Set provider rate-limit-aware concurrency limits","Surface status_code and raw_response in your error reporting"],"tags":["http","llm","api-error"],"backgroundTag":"http-error-response","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}