BoundaryML/baml · error · ExposedError
ExposedError::ClientHttpError { client_name, message, status
Error message
ExposedError::ClientHttpError { client_name, message, status_code, detailed_message, raw_response } What it means
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.
Source
Thrown at engine/baml-runtime/src/types/response.rs:138
Ok(val) => Ok(val),
Err(err) => Err(anyhow::anyhow!(self.format_last_error_with_details(err))),
})
else {
// If we don't have a parsed result, check if we have an LLMFailure
return match self.llm_response() {
LLMResponse::LLMFailure(err) => {
// Convert LLMFailure to appropriate error type
match &err.code {
crate::internal::llm_client::ErrorCode::Timeout => {
Err(anyhow::anyhow!(crate::errors::ExposedError::TimeoutError {
client_name: err.client.clone(),
message: err.message.clone(),
}))
}
crate::internal::llm_client::ErrorCode::Other(2) => {
Err(anyhow::anyhow!(err.message.clone()))
}
_ => Err(anyhow::anyhow!(
crate::errors::ExposedError::ClientHttpError {
client_name: err.client.clone(),
message: err.message.clone(),
status_code: err.code.clone(),
detailed_message: err.message.clone(),
raw_response: err.raw_response.clone(),
}
)),
}
}
LLMResponse::UserFailure(message) => {
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."))
}
LLMResponse::InternalFailure(message) => {
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."))
}
LLMResponse::Cancelled(message) => {
Err(anyhow::anyhow!(crate::errors::ExposedError::AbortError {View on GitHub (pinned to bd85ce9dee)
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.
Example fix
// before
let v = chain.content()?; // ClientHttpError 429 surfaces
// after
match chain.content() {
Ok(v) => Ok(v),
Err(e) if e.to_string().contains("429") => retry_with_backoff(),
Err(e) => Err(e),
} Defensive patterns
Strategy: retry
Try / catch
match chain.content() {
Ok(v) => Ok(v),
Err(e) if is_http_status(&e, &[429, 500, 502, 503]) => retry_with_backoff(),
Err(e) => Err(e),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Invalid or expired API keys (401), quota/rate limits (429), provider 5xx outages, wrong base URL or model name (404).
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- LLM client "{client_name}" failed with status code: {status_
- BamlError: BamlClientError: BamlClientHttpError: {message}
- Auth server returned {status}: {body}
- PostHog returned {status}
- network error fetching {url}: {source}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/b9ad69e2740bfc7a.
Report an issue: GitHub.